Assets are packaged resources, not arbitrary files the running application can discover from your development machine. The path used by Image.asset must match the asset key declared for the bundle.
Declare the files deliberately
The fragment belongs in your project’s pubspec.yaml under its existing flutter section. YAML indentation is significant; do not create a second top-level flutter section.
Worked example
This is a focused code fragment. Place it in the class or file described above; it is not a complete standalone app.
flutter:
uses-material-design: true
assets:
- assets/images/
fonts:
- family: StudioSans
fonts:
- asset: assets/fonts/StudioSans-Regular.ttf
- asset: assets/fonts/StudioSans-Bold.ttf
weight: 700
Read the result
The font family is the name you use in TextStyle or ThemeData. Use actual licensed font files at the declared paths. A directory declaration does not automatically mean every nested folder is included.
Separate a declared asset key from a local file path
The bundle is built from pubspec.yaml declarations. The code later asks that bundle for a key such as assets/images/workspace.png. A file existing somewhere on your computer is not enough; its declaration and referenced key must agree.
Check indentation, exact filename case and the scope of directory declarations. Case-insensitive local development can hide a mismatch that appears on another platform or in a release build. After changing configuration, resolve packages and restart or rebuild as required rather than expecting every bundle change to appear through hot reload.
For fonts, the declared family name is the identifier used by the theme. The file’s marketing name is not automatically that identifier. Connect this setup to image failure handling and theme configuration to verify both resource discovery and presentation.
Practice and verification
Add a real image and font, run flutter pub get and restart the application if needed. Check exact filename case on a release target. Remove an asset declaration and confirm the resulting error identifies the expected key.