相关疑难解决方法(0)

如何在flutter中将图像转换为base64图像?

我实际上是在尝试将拍摄的图像转换ImagePickerbase64图像.我总是得到错误.

FileSystemException: Cannot open file, path = 
'file:///storage/emulated/0/Download/Abid_Wipro_neemuchwala1- 
770x433.jpg' (OS Error: No such file or directory, errno = 2)
E/flutter ( 5042): #0      _File.throwIfError 
(dart:io/file_impl.dart:628)
E/flutter ( 5042): #1      _File.openSync 
(dart:io/file_impl.dart:472)
E/flutter ( 5042): #2      _File.readAsBytesSync 
(dart:io/file_impl.dart:532)
Run Code Online (Sandbox Code Playgroud)

我正在使用的代码是这个.

     File fileData;
   /////////////...........


      new Container(
            child: new FutureBuilder<File>(
              future: imageFile,
              builder: (BuildContext context, AsyncSnapshot<File> snapshot) {
                if (snapshot.connectionState == ConnectionState.done &&
                    snapshot.data != null) {
                  fileData = snapshot.data;


                  return new Container(
                    height: MediaQuery.of(context).size.height / 2,
                    width: MediaQuery.of(context).size.width,
                    margin: …
Run Code Online (Sandbox Code Playgroud)

dart flutter

12
推荐指数
3
解决办法
1万
查看次数

标签 统计

dart ×1

flutter ×1