0

This is my widget to display a little pic of myself in the app.

Widget image() {
    return CircleAvatar(
      radius: 50.0,
      backgroundImage: AssetImage('images/me.jpeg'),
    );
  }

Yet, for some reason, I keep getting this

The following assertion was thrown resolving an image codec:
Unable to load asset: images/me.jpeg

When the exception was thrown, this was the stack: 
#0      PlatformAssetBundle.load (package:flutter/src/services/asset_bundle.dart:225:7)
<asynchronous suspension>
#1      AssetBundleImageProvider._loadAsync (package:flutter/src/painting/image_provider.dart:668:31)
#2      AssetBundleImageProvider.load (package:flutter/src/painting/image_provider.dart:651:14)
#3      ImageProvider.resolveStreamForKey.<anonymous closure> (package:flutter/src/painting/image_provider.dart:504:13)
...
Image provider: AssetImage(bundle: null, name: "images/me.jpeg")
Image key: AssetBundleImageKey(bundle: PlatformAssetBundle#14309(), name: "images/me.jpeg", scale: 1.0)

Although the image is inside the folder. Please help

1
  • 1
    did you add the image path to pubspec.ymal file? Commented Apr 25, 2021 at 12:36

1 Answer 1

1

make sure you added the images to pubspec.yaml file and then run pub get

  assets:
    - images/me.jpeg
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.