Rah*_*lZx 2 flutter flutter-web imagepicker
当我在 flutter web 中使用 image_picker 时出现问题“错误:不支持的操作:Object.throw 处的命名空间[as throw] (http://localhost:56308/dart_sdk.js:5334:11) at Function.get _namespace [as _namespace] (http://localhost:56308/dart_sdk.js:55299:17) 在 io._File.new.lengthSync (http://localhost:56308/dart_sdk.js:53158:59)'
这在 android 中工作正常,在打开的图像选择窗口中并且图像已成功预览,但在 flutter web 中不起作用在网络案例中图像选择窗口打开但图像未获取。
这是我的图像选择器代码...
最终选择器= ImagePicker(); var imag =等待picker.getImage(来源:oursource);
var imageFile = File(imag.path);
Run Code Online (Sandbox Code Playgroud)
小智 7
用这个:
kIsWeb
? Image.network(selectedImage.path)
: Image.file(File(selectedImage.path)),
Run Code Online (Sandbox Code Playgroud)
我希望能工作(为时已晚;))
| 归档时间: |
|
| 查看次数: |
6929 次 |
| 最近记录: |