Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Assets Generator for FlutterNew to Visual Studio Code? Get it now.
Assets Generator for Flutter

Assets Generator for Flutter

Brendan

| (0) | Free
Generate assets file to class for flutter
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Asset Generator for Flutter

Please support me if this package is useful for you. My laptop is broken soon so your kindness is really help me a lot, Thanks.

Buy Me A Coffee, Please.

https://www.buymeacoffee.com/flutter.gen

PS. if you need add any features or find problem please let me know.

All credits for this extension go to https://github.com/sumate-sdk
Main repo can be found here https://github.com/sumate-sdk/assets-generator-flutter



Github

https://github.com/definitelyme/asset-generator-flutter.git



Update your pubspec.yaml file


flutter:
  assets:
    - assets/sound/
    - assets/images/icon/
    - assets/images/background/
    ...



Command

In VSCode press Command + Shift + P then select option

Asset Generator for Flutter: Assets >>> Generate code from pubspec.yaml assets.

Asset Generator for Flutter: Config file >>> Generate generate config file .flutgenrc in root workplace



Condition

  • asset filename must be [a-z],[A-Z],[0-9], space ,-,_
  • filename can only have one . for file type
  • filename can't be lead with [0-9]


Config file

default config file for generated result


{
  "assets" : {
    "output-path": "lib",
    "filename": "assets.dart"
  }
}



Example generated file


class Assets {
  const Assets._();

  static const sound = _AssetsSound._();
  static const images = _AssetsImages._();
  ...
}

...

class _AssetsSound {
  const _AssetsSound._();

  static const helloWorldMP3 => "assets/sound/hello world.mp3";
  static const hiACC => "assets/hi.acc";
  ...
}

class _AssetsImages {
  const _AssetsImages._();

  static const icon = _AssetsImagesIcon._();
  static const background = _AssetsImagesBackground._();
  ...
}

class _AssetsImagesIcon {
  const _AssetsImagesIcon._();

  static const chatIconSVG => "assets/images/icon/chatIcon.svg";
  static const facebookPNG => "assets/images/icon/Facebook.png";
  static const googlePlusJPG => "assets/images/icon/google-plus.jps";
  ...
}

...



Known Issues

Nothing for now if you need to add function or found an errors please let me know.



Release Notes

1.0.0

This is package come from old package Flutter Generators that I had unpublish it. This version I add .flutgenrc for config output path and filename.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft