samedi 31 août 2019

Error on retrieving assets for web (flutter)

I face an issue for Flutter WEB. I followed tutorial on assets from Flutter team (https://flutter.dev/docs/development/ui/assets-and-images) however I receive an error

 ══╡ 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)
════════════════════════════════════════════════════════════════════════════════════════════════════ 

My pubspecs.yaml

flutter:
  uses-material-design: true

  assets:
    - assets/images/

I'm loading image like this

Image.asset("assets/images/my_custom_image.png")

Where did I mess up?




Aucun commentaire:

Enregistrer un commentaire