Blue Circle is displayed in CircleAvatar Asset image instead of real image in flutter

403
  • First, make you have added image on pubspec.yaml.
  • while loading data from asset, do restart the app, not hot reload or restart.
  • if it fails, do flutter clean and run again.
  • else, make sure about image path.
  • also check this doc for supported image in flutter
Share:
403
Flutty dev
Author by

Flutty dev

Updated on December 31, 2022

Comments

  • Flutty dev
    Flutty dev over 1 year

    I am trying to display the image in the Card widget in leading CircleAvatar below is my code

    child: Card(
              child: ListTile(
                onTap: () {},
                title: Text(locations[index].location.toString()),
                leading: CircleAvatar(
                  radius: 18.0,
                  backgroundImage:
                      AssetImage('assets/${locations[index].flag}'),)
    

    Instead of the real image, I want to show, Blue color is displayed in the circle as shown in below attachment Image

    • Peter Koltai
      Peter Koltai over 2 years
      are these assets listed in your pubspec.yaml file under assets:?
  • Flutty dev
    Flutty dev over 2 years
    Restarting the app work for me, Thank you