Images and icons
Every generated app has an asset resolver in lib/core/asset_resolver/, the same pattern the team's production apps use. Asset paths are written in one file, and screens ask for a widget instead of building Image.asset or SvgPicture.asset from a string.
assets/
icons/ small UI glyphs: ic_<name>.svg
images/ logos, illustrations, photos: <name>.svg / <name>.png
lib/core/asset_resolver/
image_resource.dart ImageResource: getPath + getImageWidget(...)
asset_image_provider.dart AssetImageProvider: .assetImage
svg_image_resource.dart SVGImageResource (flutter_svg)
png_image_resource.dart PNGImageResource (Image.asset + AssetImage)
resource_resolver.dart ImageResourceResolver: one entry per fileBoth folders are declared in pubspec.yaml, and flutter_svg is a dependency. The app starts with one example, assets/images/app_logo.svg.
Adding an asset
Put the file in the right folder with a snake_case name, e.g.
assets/icons/ic_search.svg. Use SVG for anything vector, and PNG with2.0x/and3.0x/variants for photos.Add one entry to
ImageResourceResolver:dartstatic const SVGImageResource searchIcon = SVGImageResource( '$iconBasePath/ic_search.svg', );Use it:
dartImageResourceResolver.searchIcon.getImageWidget( width: 24, height: 24, color: context.colors.primary, // tints the SVG ); // Raster images also work where an ImageProvider is needed: DecorationImage(image: ImageResourceResolver.emptyOrders.assetImage);
A new sub-folder such as assets/images/onboarding/ must also be added to pubspec.yaml, because asset folders aren't recursive.
What keeps it honest
test/core/asset_resolver/resource_resolver_test.dart runs with the rest of the suite (and so in quality_gate.sh and CI). It fails when:
- a path in
ImageResourceResolverhas no file on disk, or - any Dart file under
lib/outsidelib/core/asset_resolver/contains an'assets/...'string.
The flutter-assets skill and the rule in AGENTS.md tell AI agents the same thing, and the architecture review checks for raw Image.asset and SvgPicture.asset calls. The Figma-to-Flutter skill exports icons and images straight into these folders and registers them in the resolver.