我在我的 flutter 应用程序上加载图像,如下所示:
Image.asset(imageFilePath, fit: BoxFit.cover)
当我第一次在模拟器上运行应用程序时,出现以下异常:
I/flutter (7194):══╡图像资源服务捕获异常
╞═══════════════════════════════════════ ══════════ ═══我/扑(
7194): 解析图像编解码器时抛出以下断言:
I/flutter (7194):无法加载资源:
/data/user/0/com.example.myapp/app_flutter/888cba5135c38f7d.jpg ...
图片路径正确,文件存在。
If I re-run the application (click the button), the application loads without the exception and the image appears just fine.
可能是什么问题?
Note:
-
flutter doctor
表示一切都很好
- 颤振版本:v1.9.1+hotfix.2
您是说您的文件不是资产,然后使用另一个 Image 构造函数:
final img = Image.file(File(imageFilePath));
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)