1. Create assets, folders, files:
2. Update dev_dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
integration_test:
sdk: flutter
build_runner: ^2.4.6
flutter_gen_runner: ^5.3.1
flutter_gen:
output: lib/generated/assets/ # Optional (default: lib/gen/)
line_length: 80 # Optional (default: 80)
integrations:
flutter_svg: true
assets:
enabled: true
outputs:
class_name: MyAssets
package_parameter_enabled: false
# Assets.imagesChip
# style: camel-case
# Assets.images_chip
# style: snake-case
# Assets.images.chip (default style)
style: dot-delimiter
exclude:
- assets/images/chip3/chip3.jpg
- pictures/chip5.jpg
- assets/flare/
fonts:
enabled: true
outputs:
class_name: MyFontFamily
colors:
enabled: true
outputs:
class_name: MyColorName
inputs:
- assets/color/colors.xml
- assets/colors/colors.xml
flutter:
uses-material-design: true
assets:
- assets/images/
- assets/images/chip3/chip3.jpg
- assets/images/chip4/
- assets/images/icons/fuchsia.svg
- assets/json/
- pictures/chip5.jpg
- assets/flare/
fonts:
- family: Raleway
fonts:
- asset: assets/fonts/Raleway-Regular.ttf
- asset: assets/fonts/Raleway-Italic.ttf
style: italic
- family: RobotoMono
fonts:
- asset: assets/fonts/RobotoMono-Regular.ttf
- asset: assets/fonts/RobotoMono-Bold.ttf
weight: 700
3. Run command to generate files:
# flutter pub run build_runner build --delete-conflicting-outputs REM generated assets, files, fonts, colors,...
or
# dart run build_runner build --delete-conflicting-outputs REM generated assets, files, fonts, colors,...
4. Generated files:
5. Use case: