【发布时间】:2020-01-04 09:05:38
【问题描述】:
我遇到了 Flutter WEB 的问题。我按照 Flutter 团队 (https://flutter.dev/docs/development/ui/assets-and-images) 的资产教程进行操作,但收到错误消息
══╡ EXCEPTION CAUGHT BY IMAGE RESOURCE SERVICE ╞════════════════════════════════════════════════════
The following assertion was thrown resolving an image codec:
Unable to load asset: assets/images/my_custom_image.png
When the exception was thrown, this was the stack:
dart:sdk_internal 4602:11 throw_
load
package:flutter_web/…/services/asset_bundle.dart:220
dart:sdk_internal 25309:9 <fn>
...
Image provider: AssetImage(bundle: null, name: "assets/images/my_custom_image.png")
Image key: AssetBundleImageKey(bundle: PlatformAssetBundle#078a9(), name:
"assets/images/my_custom_image.png", scale: 1)
════════════════════════════════════════════════════════════════════════════════════════════════════
我的 pubspecs.yaml
flutter:
uses-material-design: true
assets:
- assets/images/
我正在加载这样的图像
Image.asset("assets/images/my_custom_image.png")
我在哪里搞砸了?
【问题讨论】:
标签: image flutter assets flutter-web