Flutterweb图像加载在移动视图中,但不是全视图?
我正在使用 FadeInImage 小部件从网络加载图像
当页面在开发人员控制台的移动视图中刷新时,图像加载正常,但在完整视图中它给了我一个异常
The following ImageCodecException was thrown resolving an image codec:
Failed to load network image.
Image URL: https://api.gogoz.in/static/img/FF000001FV0000007.jpg
Trying to load an image from another domain? Find answers at:
https://flutter.dev/docs/development/platform-integration/web-images
When the exception was thrown, this was the stack:
...
Image provider: NetworkImage("https://api.gogoz.in/static/img/FF000001FV0000007.jpg", scale: 1)
Image key: NetworkImage("https://api.gogoz.in/static/img/FF000001FV0000007.jpg", scale: 1)
我没有想法解决这个问题
回答
问题:
这似乎与最近的测试版本1.26(2021年2月),默认renderer似乎已经从切换html到canvaskit。
使固定:
在 中工作时Web,使用html渲染器而不是canvaskit. 这是如何:
- 如果您从命令行“运行”,请使用以下命令:
flutter run -d chrome --web-renderer html
- 如果您使用 Android Studio:转到
Run/ Run.../ Edit Configurations.../,然后Additional arguments添加此--web-renderer html.
如果这有帮助,请不要忘记“标记”答案;0)