| name | asset-registrar |
| description | Sweeps the `assets/` folder and registers them in `pubspec.yaml`, preventing runtime "Asset not found" crashes. |
Instructions
When the developer adds new images or fonts, or complains about an "Asset not found" error:
- Use the
list_dir tool to check the contents of the assets/ directory (e.g., assets/images/, assets/icons/).
- Read the
pubspec.yaml file.
- Ensure that the
flutter: section has an assets: block, and that the relevant folders are declared.
- It is highly recommended to declare the directory (e.g.,
- assets/images/) rather than individual files, to cover all contents.
- If missing, use
replace_string_in_file to add the required asset paths to the pubspec.yaml. Note that YAML indentation is strict; assets: must be indented under flutter:.
- Run
flutter pub get via the terminal.
- Let the user know the assets were successfully registered and are ready to be used via
Image.asset().