Multiple assets in Flutter project

Question

Asked by rbasniak on March 24, 2018 (source).

According to documentation to include image assets in a Flutter project, I need to add them to the pubspec.yaml like this:

flutter:
  assets:
   - assets/my_icon.png
   - assets/background.png

But I have ~900 images that I need to include in my application, do I really need to manually include one by one in the file?

Answer

Question answered by Günter Z (source).

Yes, currently this is required and a known limitation.

Wildcarding assets in pubspec.yaml (or allow an entire directory to be included) #4890

You could use code generation to get the assets listed all at once, but you'll also get into troubles when the list becomes too long.

FLUTTER
SHARE: