asset_ not_ string_ or_ map
An asset value is required to be a file path (string) or map.
Description
#The analyzer produces this diagnostic when an asset value isn't a string or a map.
Example
#The following code produces this diagnostic because the asset value is a list:
name: example
flutter:
assets:
- [one, two, three]
Common fixes
#
If you need to specify more than just the path to the asset, then replace
the value with a map with a
path
key (a valid POSIX-style file path):
name: example
flutter:
assets:
- path: assets/image.gif
flavors:
- premium
If you only need to specify the path, then replace the value with the path to the asset (a valid POSIX-style file path):
name: example
flutter:
assets:
- assets/image.gif
Unless stated otherwise, the documentation on this site reflects Dart 3.9.2. Page last updated on 2025-9-1. View source or report an issue.