1. Flutter
  2. Keep Coding

FlutterError: Unable to load asset

You should consider the indentation for assets

Flutter uses the Pubspec.yaml file, located at the root of your project, to identify assets required by an app.

Here is an example:

flutter:

  assets:
    - images/pizza1.png
    - images/pizza0.png

More details:

flutter:

[2 whitespaces or 1 tab]assets:
[4 whitespaces or 2 tabs]- images/pizza1.png
[4 whitespaces or 2 tabs]- images/pizza0.png

 Note: Only files located directly in the directory are included unless there are files with the same name inside a subdirectory . To add files located in subdirectories, create an entry per directory.