UI, Assets & L10N
flutter_asset Free
- Tier
- Freeversion 1.2.5
- Command
archipelago generate flutter_asset- Generates
packages/asset_corepackages/<app_name>_asset
- Used by
- flutter_ui_kit
A Mason brick for generating type-safe asset packages with pure Dart contracts (asset_core) and Flutter asset enums with real SVG icons and Lottie animations.
Variables
| Variable | Type | Default | Description |
|---|---|---|---|
| appName | string | MyApp | Application name for package naming |
| prefix | string | App | Prefix for asset class names |
| isForMonorepo | boolean | true | Whether this package will be part of a monorepo structure |
| includeGenerated | boolean | false | Whether to include generated files in version control |
Usage
Interactive
archipelago generate flutter_assetNon-interactive (CI)
archipelago generate flutter_asset --config my_config.jsonConfig Template
{
"@appName": "Application name for package naming",
"appName": "MyApp",
"@prefix": "Prefix for asset class names",
"prefix": "App",
"@isForMonorepo": "Whether this package will be part of a monorepo structure",
"isForMonorepo": true,
"@includeGenerated": "Whether to include generated files in version control",
"includeGenerated": false
}Generated Structure
packages/
├── asset_core/
│ ├── lib/
│ │ ├── asset_core.dart # Barrel file
│ │ └── src/
│ │ ├── {prefix}_asset.dart
│ │ ├── {prefix}_asset_category.dart
│ │ ├── {prefix}_asset_data.dart
│ │ ├── {prefix}_asset_type.dart
│ │ └── contracts/
│ │ ├── contracts.dart
│ │ ├── {prefix}_animation_asset.dart
│ │ ├── {prefix}_icon_asset.dart
│ │ ├── {prefix}_illustration_asset.dart
│ │ └── {prefix}_logo_asset.dart
│ ├── analysis_options.yaml
│ └── pubspec.yaml
└── {app_name}_asset/
├── lib/
│ ├── {app_name}_asset.dart # Barrel file
│ └── src/
│ └── generated/
│ ├── generated.dart
│ ├── animations.dart
│ ├── logos.dart
│ └── icons/
│ ├── icons.dart
│ ├── actions_icons.dart
│ ├── arrows_icons.dart
│ ├── communication_icons.dart
│ ├── essentials_icons.dart
│ ├── feedback_icons.dart
│ ├── files_icons.dart
│ ├── finance_icons.dart
│ ├── maps_icons.dart
│ ├── media_icons.dart
│ ├── security_icons.dart
│ ├── time_icons.dart
│ └── users_icons.dart
├── assets/
│ ├── icons/ # SVG icons by category
│ │ ├── actions/
│ │ ├── arrows/
│ │ ├── communication/
│ │ ├── essentials/
│ │ ├── feedback/
│ │ ├── files/
│ │ ├── finance/
│ │ ├── maps/
│ │ ├── media/
│ │ ├── security/
│ │ ├── time/
│ │ └── users/
│ ├── animations/ # Lottie animations (.json or .lottie)
│ └── logos/ # Logo assets
├── analysis_options.yaml
├── asset_generator.yaml # Since 1.1.0 — see below
└── pubspec.yamlAPI
asset_core is a pure-Dart contracts package — no Flutter dependency. Every generated asset is a type-safe enum implementing one of its contracts:
abstract interface class AppAsset {
AppAssetData get data;
String get defaultSemanticLabel;
}
abstract interface class AppIconAsset implements AppAsset {
static const double sizeSmall = 16.0;
static const double sizeMedium = 24.0;
static const double sizeLarge = 32.0;
static const category = AppAssetCategory.icon;
}
// AppAnimationAsset, AppIllustrationAsset, AppLogoAsset follow the same shape.Generated icons are per-category enums implementing AppIconAsset, one enum value per SVG file:
// {app_name}_asset/lib/src/generated/icons/actions_icons.dart
enum AppActionsIcons(this.filename) implements AppIconAsset {
copy('copy.svg'),
download('download.svg'),
search('search.svg'),
settings('settings.svg'),
// ...
}Since 1.2.1, the pre-baked files match a fresh asset_generator 1.2.1 run: each enum uses a primary constructor, and only enums with a _dark variant (here logos.dart) carry a _darkFilename field. See asset_generator for both shapes. The public API is unchanged.
flutter_ui_kit's AssetWidget/{prefix}AssetExtension render any AppAsset value directly — the asset package itself has no rendering code (that's asset_core's pure-Dart split: contracts here, Flutter rendering in the UI kit).
Asset Generator Config
Since 1.1.0, the generated package ships asset_generator.yaml, templated with this package's real assets_path: assets, output_path: lib/src/generated, prefix, package_name, and the 12 real icon subcategory directories — so the separate asset_generator devtool brick (dart run monorepo_toolkit asset-gen generate) can rediscover and regenerate this exact structure with the correct prefix, instead of silently falling back to CLI defaults.
Dependencies
asset_corehas no Flutter dependency — pure Dart contracts only.- Since 1.2.0,
{Prefix}AssetType.lottie.extensionsis['.json', '.lottie']and{Prefix}AssetTypeExtension.fromPathmaps.lottie(dotLottie zip) paths to{Prefix}AssetType.lottie. Thelottiepackage renders both formats, so no widget change is needed. - The generated
{app_name}_assetpackage depends onasset_core(path) and ships the SVG/Lottie assets themselves; no external pub packages are required to hold the type-safe references (rendering libraries likeflutter_svg/lottielive influtter_ui_kit, not here). - No self-generation and no hard dependency on another brick.
Known Limitations
- No native platform setup — pure Dart/Flutter assets.
- Regenerating assets from source SVGs/Lottie files (e.g. after adding new icons) requires the separate
asset_generatorbrick; this brick only produces the initial, pre-baked snapshot.
Changelog
Run archipelago brick info flutter_asset to see the latest published version. Enterprise customers can read the full CHANGELOG.md in the brick source repository.