[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-9334":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":16,"stars30d":17,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":18,"rankGlobal":10,"rankLanguage":10,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":20,"hasPages":20,"topics":22,"createdAt":10,"pushedAt":10,"updatedAt":31,"readmeContent":32,"aiSummary":33,"trendingCount":16,"starSnapshotCount":16,"syncStatus":34,"lastSyncTime":35,"discoverSource":36},9334,"flutter_gen","FlutterGen\u002Fflutter_gen","FlutterGen","The Flutter code generator for your assets, fonts, colors, … — Get rid of all String-based APIs.","https:\u002F\u002Fpub.dev\u002Fpackages\u002Fflutter_gen",null,"Dart",1577,181,12,25,0,3,55.08,"MIT License",false,"main",[23,24,25,26,27,28,29,30],"assets","code-generator","dart","flutter","fluttergen","fonts","swiftgen","templates","2026-06-12 04:00:44","\u003Cp align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Fpub.dev\u002Fpackages\u002Fflutter_gen\">\n    \u003Cimg src=\"https:\u002F\u002Fgithub.com\u002FFlutterGen\u002Fflutter_gen\u002Fraw\u002Fmain\u002Fart\u002Flogo.png\" width=\"480px\" alt=\"Logo\"\u002F>\n  \u003C\u002Fa>\n\u003C\u002Fp>\n\u003Cp align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Fpub.dartlang.org\u002Fpackages\u002Fflutter_gen\">\n    \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fpub\u002Fv\u002Fflutter_gen.svg\" alt=\"Pub\">\n  \u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002FFlutterGen\u002Fflutter_gen\u002Factions?query=workflow%3A%22Dart+CI%22\">\n    \u003Cimg src=\"https:\u002F\u002Fgithub.com\u002FFlutterGen\u002Fflutter_gen\u002Fworkflows\u002FBuild\u002Fbadge.svg\" alt=\"Build Status\"\u002F>\n  \u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fcodecov.io\u002Fgh\u002FFlutterGen\u002Fflutter_gen\">\n    \u003Cimg src=\"https:\u002F\u002Fcodecov.io\u002Fgh\u002FFlutterGen\u002Fflutter_gen\u002Fbranch\u002Fmain\u002Fgraph\u002Fbadge.svg\" alt=\"Coverage\"\u002F>\n  \u003C\u002Fa>\n\u003C\u002Fp>\n\nThe Flutter code generator for your assets, fonts, colors, … — Get rid of all String-based APIs.\n\nInspired by [SwiftGen](https:\u002F\u002Fgithub.com\u002FSwiftGen\u002FSwiftGen).\n\n## Motivation\n\nUsing asset path string directly is not safe.\n\n```yaml\n# pubspec.yaml\nflutter:\n  assets:\n    - assets\u002Fimages\u002Fprofile.jpg\n```\n\n❌ **Bad**  \nWhat would happen if you made a typo?\n\n```dart\nWidget build(BuildContext context) {\n  return Image.asset('assets\u002Fimages\u002Fprofile.jpeg');\n}\n\n\u002F\u002F The following assertion was thrown resolving an image codec:\n\u002F\u002F Unable to load asset: assets\u002Fimages\u002Fprofile.jpeg\n```\n\n⭕️ **Good**  \nWe want to use it safely.\n\n```dart\nWidget build(BuildContext context) {\n  return Assets.images.profile.image();\n}\n```\n\n## Installation\n\n### As a part of build_runner\n\n1. Add [build_runner] and [FlutterGen] to your package's pubspec.yaml file:\n\n   ```yaml\n   environment:\n     sdk: ^3.7.0\n\n   dev_dependencies:\n     build_runner: ^2.12.0\n     flutter_gen_runner:\n   ```\n\n   `flutter_gen_runner` now relies on post-process builders with\n   `build_to: source`, so `build_runner >=2.12.0` is required.\n\n2. Install [FlutterGen]\n\n   ```sh\n   flutter pub get\n   ```\n\n3. Use [FlutterGen]\n\n   ```sh\n   dart run build_runner build\n   ```\n\n#### Pub workspaces\n\nFlutterGen also supports [`dart pub` workspaces](https:\u002F\u002Fdart.dev\u002Ftools\u002Fpub\u002Fworkspaces).\nRun `build_runner` from the workspace root, and make sure each workspace member\nthat should be built has `resolution: workspace` in its `pubspec.yaml`.\n\n```yaml\n# workspace root pubspec.yaml\nenvironment:\n  sdk: ^3.7.0\n\nworkspace:\n  - packages\u002Fapp\n```\n\n```yaml\n# packages\u002Fapp\u002Fpubspec.yaml\nname: app\nresolution: workspace\n\ndev_dependencies:\n  flutter_gen_runner:\n  build_runner: ^2.12.0\n```\n\n```sh\ndart run build_runner build --workspace\n```\n\nFlutterGen will resolve each package from the active build target instead of the\nprocess working directory, so package-local `pubspec.yaml` configuration and\noutput paths continue to work in workspace builds.\n\nIf generated source files were removed manually while `.dart_tool\u002Fbuild` is\nstill present, run `dart run build_runner clean` from the workspace root before\nrunning `build --workspace` again. The current post-process builder flow can\nre-materialize files reliably after a clean build, but a warm incremental build\nmay skip unchanged manifests.\n\nFor workspace builds, use Dart `>=3.7.0` together with `build_runner >=2.12.0`.\n\n### Pub Global\n\nWorks with macOS, Linux and Windows.\n\n```sh\ndart pub global activate flutter_gen\n```\n\nYou might need to [set up your path](https:\u002F\u002Fdart.dev\u002Ftools\u002Fpub\u002Fcmd\u002Fpub-global#running-a-script-from-your-path).\n\n### Homebrew\n\nWorks with macOS and Linux.\n\n```sh\nbrew install FlutterGen\u002Ftap\u002Ffluttergen\n```\n\n### asdf\n\nWorks with macOS and Linux.\nasdf-fluttergen is compatible with [mise](https:\u002F\u002Fmise.jdx.dev\u002F).\n\n```sh\n# add plugin\nasdf plugin add fluttergen\n# or\nasdf plugin add fluttergen https:\u002F\u002Fgithub.com\u002FFlutterGen\u002Fasdf-fluttergen.git\n\n# install fluttergen\nasdf install fluttergen latest\n```\n\nSee also: [FlutterGen\u002Fasdf-fluttergen](https:\u002F\u002Fgithub.com\u002FFlutterGen\u002Fasdf-fluttergen)\n\n### GitHub Actions\n\nWorks with macOS and Linux.\n\n```yaml\n- uses: FlutterGen\u002Fsetup-fluttergen@v1\n  with:\n    version: ${{ fluttergen_version }}\n```\n\nSee also: [FlutterGen\u002Fsetup-fluttergen](https:\u002F\u002Fgithub.com\u002FFlutterGen\u002Fsetup-fluttergen)\n\n## Usage\n\nRun `fluttergen` after the configuration [`pubspec.yaml`](https:\u002F\u002Fdart.dev\u002Ftools\u002Fpub\u002Fpubspec).\n\n```sh\nfluttergen -h\n\nfluttergen -c example\u002Fpubspec.yaml\n\nfluttergen --workspace -c pubspec.yaml\n```\n\nUse `--workspace` to treat the config file as a workspace root pubspec and run\ngeneration for each listed workspace member. Without `--workspace`, the command\ngenerates for exactly one package.\n\nWhen `--workspace` is enabled, the root `pubspec.yaml` is used only to discover\nworkspace members from its `workspace:` section. FlutterGen then switches to\neach member package and loads that package's own `pubspec.yaml` and, if\npresent, its local `build.yaml`.\n\nThat means workspace-wide command execution behaves like this:\n\n- Root `pubspec.yaml`: selects which packages to visit.\n- Member `pubspec.yaml`: provides `flutter` and `flutter_gen` configuration.\n- Member `build.yaml`: overrides generator options for that member only.\n\nThe `--build` option is only available in single-package mode. In workspace\nmode, put any overrides in each package's local `build.yaml` instead.\n\n## Configuration file\n\n[FlutterGen] generates dart files based on the key **`flutter`** and **`flutter_gen`** of [`pubspec.yaml`](https:\u002F\u002Fdart.dev\u002Ftools\u002Fpub\u002Fpubspec).  \nDefault configuration can be found [here](https:\u002F\u002Fgithub.com\u002FFlutterGen\u002Fflutter_gen\u002Ftree\u002Fmain\u002Fpackages\u002Fcore\u002Flib\u002Fsettings\u002Fconfig_default.dart).\n\n```yaml\n# pubspec.yaml\n# ...\n\nflutter_gen:\n  output: lib\u002Fgen\u002F # Optional (default: lib\u002Fgen\u002F)\n  # line_length: 80 # Optional\n\n  # Optional\n  integrations:\n    image: true\n    flutter_svg: true\n    rive: true\n    lottie: true\n\n  colors:\n    inputs:\n      - assets\u002Fcolor\u002Fcolors.xml\n\nflutter:\n  uses-material-design: true\n  assets:\n    - assets\u002Fimages\u002F\n\n  fonts:\n    - family: Raleway\n      fonts:\n        - asset: assets\u002Ffonts\u002FRaleway-Regular.ttf\n        - asset: assets\u002Ffonts\u002FRaleway-Italic.ttf\n          style: italic\n```\n\n### build.yaml\n\nWhen using `build_runner`, you can also configure generator options in the\ntarget `build.yaml`. These builder options are applied on top of the\n`pubspec.yaml` configuration for the current target.\n\n```yaml\n# build.yaml\n# ...\n\ntargets:\n  $default:\n    builders:\n      flutter_gen_runner: # or flutter_gen\n        options:\n          output: lib\u002Fbuild_gen\u002F # Optional (default: lib\u002Fgen\u002F)\n          line_length: 120 # Optional\n```\n\n## Available Parsers\n\n### Assets\n\nFollowing the doc\n[Adding assets and images#Specifying assets](https:\u002F\u002Fflutter.dev\u002Fdocs\u002Fdevelopment\u002Fui\u002Fassets-and-images#specifying-assets)\nto specify assets, then [FlutterGen] will generate related dart files.  \nNo other specific configuration is required.  \n_Ignore duplicated._\n\n```yaml\n# pubspec.yaml\nflutter:\n  assets:\n    - assets\u002Fimages\u002F\n    - assets\u002Fimages\u002Fchip3\u002Fchip.jpg\n    - assets\u002Fimages\u002Fchip4\u002Fchip.jpg\n    - path: assets\u002Fimages\u002Ficons\u002Fpaint.svg\n    - path: assets\u002Fimages\u002Ficons\u002Ftransformed.svg\n      transformers:\n        - package: vector_graphics_compiler\n    - assets\u002Fimages\u002Ficons\u002Fdart@test.svg\n    - assets\u002Fjson\u002Ffruits.json\n    - assets\u002Fflare\u002FPenguin.flr\n    - assets\u002Frive\u002Fvehicles.riv\n    - pictures\u002Focean_view.jpg\n\n  # Also include assets from deferred components\n  # https:\u002F\u002Fdocs.flutter.dev\u002Fperf\u002Fdeferred-components\n  deferred-components:\n    - name: myDeferredComponent\n      assets:\n        - assets\u002Fimages\u002Fanother_image.jps\n        - assets\u002Fvideos\u002Fa_large_video.mp4\n```\n\nThese configurations will generate **`assets.gen.dart`** under the **`lib\u002Fgen\u002F`** directory by default.\n\n#### Flavored assets\n\nFlutter supports\n[Conditionally bundling assets based on flavor](https:\u002F\u002Fdocs.flutter.dev\u002Fdeployment\u002Fflavors#conditionally-bundling-assets-based-on-flavor).\nAssets are only available with flavors if specified.\n`flutter_gen` will generate the specified `flavors` for assets regardless the current flavor.\nThe `flavors` field accessible though `.flavors`, for example:\n\n```dart\nprint(MyAssets.images.chip4.flavors); \u002F\u002F -> {'extern'}\n```\n\n#### Excluding generating for assets\n\nYou can specify `flutter_gen > assets > exclude` using `Glob` patterns to exclude particular assets.\n\n```yaml\nflutter_gen:\n  assets:\n    exclude:\n      - folder-your-want-to-exclude\u002F**\n      - specified-asset.jpg\n```\n\nSee more patterns with the `package:glob`.\n\n#### Generate for packages\n\nIf you want to generate assets for a package,\nuse `package_parameter_enabled` under `flutter_gen > assets > outputs`.\n\n```yaml\nflutter_gen:\n  assets:\n    outputs:\n      package_parameter_enabled: true # \u003C- Add this line.\n```\n\nThis would add the package constant to the generated class. For example:\n\n```dart\nclass Assets {\n  const Assets._();\n\n  static const String package = 'test';\n\n  static const $AssetsImagesGen images = $AssetsImagesGen();\n  static const $AssetsUnknownGen unknown = $AssetsUnknownGen();\n}\n```\n\nThen you can use assets with the package implicitly or explicitly:\n\n```dart\n\u002F\u002F Implicit usage for `Image`\u002F`SvgPicture`\u002F`Lottie`.\nWidget build(BuildContext context) {\n  return Assets.images.icons.paint.svg(\n    width: 120,\n    height: 120,\n  );\n}\n```\n\nor\n\n```dart\n\u002F\u002F Explicit usage for `Image`\u002F`SvgPicture`\u002F`Lottie`.\nWidget build(BuildContext context) {\n  return SvgPicture.asset(\n    Assets.images.icons.paint.path,\n    package: Assets.package,\n    width: 120,\n    height: 120,\n  );\n}\n```\n\n#### Generate directories path\n\nIf you want to generate the path of directories,\nuse `directory_path_enabled` under `flutter_gen > assets > outputs`.\n\n```yaml\nflutter_gen:\n  assets:\n    outputs:\n      directory_path_enabled: true # \u003C- Add this line.\n```\n\nThis would add the `path` getter to the generated directory class. For example:\n\n```dart\nclass $AssetsImagesGen {\n  const $AssetsImagesGen();\n\n  \u002F\u002F\u002F******\u002F\u002F\u002F\n\n  \u002F\u002F\u002F Directory path: assets\u002Fimages\n  String get path => 'assets\u002Fimages';\n}\n```\n\n#### Including additional metadata\n\nAt build time, additional metadata may be included in the generated class, by using the\n`parse_metadata` option.\n\n```yaml\nflutter_gen:\n  parse_metadata: true # \u003C- Add this line (default: false)\n```\n\nFor image based assets, a new nullable `size` field is added to the\ngenerated class. For example:\n\n```dart\nAssetGenImage get logo => const AssetGenImage(\n  'assets\u002Fimages\u002Flogo.png',\n  size: Size(209.0, 49.0),\n);\n```\n\nWhich can now be used at runtime without parsing the information from the actual asset.\n\n```dart\nWidget build(BuildContext context) {\n  return Assets.images.logo.size!.width;\n}\n```\n\nYou can use `parse_animation` to generate more animation details.\nIt will automatically parse all animation information for GIF and WebP files,\nincluding frames, duration, etc. As this option significantly increases generation time,\nThe option is disabled by default; enabling it will significantly increase the generation elapse.\n\n```yaml\nflutter_gen:\n  images:\n    parse_animation: true # \u003C- Add this line (default: false)\n    # This option implies parse_metadata: true when parsing images.\n```\n\nFor GIF and WebP animation, several new nullable field is added to the\ngenerated class. For example:\n\n```dart\nAssetGenImage get animated =>\n  const AssetGenImage(\n    'assets\u002Fimages\u002Fanimated.webp',\n    size: Size(209.0, 49.0),\n    isAnimation: true,\n    duration: Duration(milliseconds: 1000),\n    frames: 15,\n  );\n```\n\n#### Usage Example\n\n[FlutterGen] generates [Image](https:\u002F\u002Fapi.flutter.dev\u002Fflutter\u002Fwidgets\u002FImage-class.html) class if the asset is Flutter supported image format.\n\nExample results of `assets\u002Fimages\u002Fchip.jpg`:\n\n- **`Assets.images.chip`** is an implementation of [`AssetImage class`](https:\u002F\u002Fapi.flutter.dev\u002Fflutter\u002Fpainting\u002FAssetImage-class.html).\n- **`Assets.images.chip.image(...)`** returns [`Image class`](https:\u002F\u002Fapi.flutter.dev\u002Fflutter\u002Fwidgets\u002FImage-class.html).\n- **`Assets.images.chip.provider(...)`** returns [`ImageProvider class`](https:\u002F\u002Fapi.flutter.dev\u002Fflutter\u002Fpainting\u002FImageProvider-class.html).\n- **`Assets.images.chip.path`** just returns the path string.\n- **`Assets.images.chip.values`** just returns the values list.\n\n```dart\nWidget build(BuildContext context) {\n  return Assets.images.chip.image();\n}\n\nWidget build(BuildContext context) {\n  return Assets.images.chip.image(\n    width: 120,\n    height: 120,\n    fit: BoxFit.scaleDown,\n  );\n\nWidget build(BuildContext context) {\n  \u002F\u002F Assets.images.chip.path = 'assets\u002Fimages\u002Fchip3\u002Fchip3.jpg'\n  return Image.asset(Assets.images.chip.path);\n}\n\n```\n\nIf you do not want to generate `AssetGenImage`, set `flutter_gen > integrations > image` to `false`.\n\n```yaml\n# pubspec.yaml\nflutter_gen:\n  integrations:\n    image: false\n```\n\nIf you are using SVG images with [flutter_svg](https:\u002F\u002Fpub.dev\u002Fpackages\u002Fflutter_svg) you can use the integration feature. This feature also supports using `vector_graphics_compiler` transformer and the produced code will use the `AssetBytesLoader` for such transformed assets.\n\n```yaml\n# pubspec.yaml\nflutter_gen:\n  integrations:\n    flutter_svg: true\n\nflutter:\n  assets:\n    - assets\u002Fimages\u002Ficons\u002Fpaint.svg\n    - path: assets\u002Fimages\u002Ficons\u002Ftransformed.svg\n      transformers:\n        - package: vector_graphics_compiler\n```\n\n```dart\nWidget build(BuildContext context) {\n  return Assets.images.icons.paint.svg(\n    width: 120,\n    height: 120\n  );\n}\n```\n\n**Available Integrations**\n\n| Packages                                            | File extension             | Setting             | Usage                                     |\n| --------------------------------------------------- | -------------------------- | ------------------- | ----------------------------------------- |\n| [flutter_svg](https:\u002F\u002Fpub.dev\u002Fpackages\u002Fflutter_svg) | .svg                       | `flutter_svg: true` | Assets.images.icons.paint.**svg()**       |\n| [rive](https:\u002F\u002Fpub.dev\u002Fpackages\u002Frive)               | .riv                       | `rive: true`        | Assets.rive.vehicles.**rive()**           |\n| [lottie](https:\u002F\u002Fpub.dev\u002Fpackages\u002Flottie)           | .json, .zip, .lottie, .tgs | `lottie: true`      | Assets.lottie.hamburgerArrow.**lottie()** |\n\n**Note:** For [lottie](https:\u002F\u002Fpub.dev\u002Fpackages\u002Flottie) integration with `.lottie` and `.tgs` files, you must add a custom decoder via `decoder` parameter, see [lottie's document](https:\u002F\u002Fpub.dev\u002Fpackages\u002Flottie#telegram-stickers-tgs-and-dotlottie-lottie) for more information.\n\nIn other cases, the asset is generated as String class.\n\n```dart\n\u002F\u002F If don't use the Integrations.\nfinal svg = SvgPicture.asset(Assets.images.icons.paint);\n\nfinal json = await rootBundle.loadString(Assets.json.fruits);\n```\n\n[FlutterGen] also support generating other style of `Assets` class:\n\n```yaml\n# pubspec.yaml\nflutter_gen:\n  assets:\n    outputs:\n      # Assets.imagesChip\n      # style: camel-case\n\n      # Assets.images_chip\n      # style: snake-case\n\n      # Assets.images.chip (default style)\n      # style: dot-delimiter\n\nflutter:\n  assets:\n    - assets\u002Fimages\u002Fchip.png\n```\n\nThe root directory will be omitted if it is either **`assets`** or **`asset`**.\n\n```\nassets\u002Fimages\u002Fchip3\u002Fchip.jpg      => Assets.images.chip3.chip\nassets\u002Fimages\u002Fchip4\u002Fchip.jpg      => Assets.images.chip4.chip\nassets\u002Fimages\u002Ficons\u002Fpaint.svg     => Assets.images.icons.paint\nassets\u002Fimages\u002Ficons\u002Fdart@test.svg => Assets.images.icons.dartTest\nassets\u002Fjson\u002Ffruits.json           => Assets.json.fruits\npictures\u002Focean_view.jpg           => Assets.pictures.oceanView\n```\n\n[Example of code generated by FlutterGen](https:\u002F\u002Fgithub.com\u002FFlutterGen\u002Fflutter_gen\u002Fblob\u002Fmain\u002Fexamples\u002Fexample\u002Flib\u002Fgen\u002Fassets.gen.dart)\n\n### Fonts\n\nJust follow the doc [Use a custom font](https:\u002F\u002Fflutter.dev\u002Fdocs\u002Fcookbook\u002Fdesign\u002Ffonts) to specify fonts, then [FlutterGen] will generate related dart files.  \nNo other specific configuration is required.  \n_Ignore duplicated._\n\n```yaml\n# pubspec.yaml\nflutter:\n  fonts:\n    - family: Raleway\n      fonts:\n        - asset: assets\u002Ffonts\u002FRaleway-Regular.ttf\n        - asset: assets\u002Ffonts\u002FRaleway-Italic.ttf\n          style: italic\n    - family: RobotoMono\n      fonts:\n        - asset: assets\u002Ffonts\u002FRobotoMono-Regular.ttf\n        - asset: assets\u002Ffonts\u002FRobotoMono-Bold.ttf\n          weight: 700\n```\n\nThese configurations will generate **`fonts.gen.dart`** under the **`lib\u002Fgen\u002F`** directory by default.\n\n#### Generate for packages\n\nIf you want to generate fonts for a package,\nuse `package_parameter_enabled` under `flutter_gen > fonts > outputs`.\n\n```yaml\nflutter_gen:\n  fonts:\n    outputs:\n      package_parameter_enabled: true # \u003C- Add this line.\n```\n\nThis would add the package constant to the generated class. For example:\n\n```dart\nclass Fonts {\n  Fonts._();\n\n  static const String package = 'test';\n\n  static const String raleway = 'packages\u002F$package\u002FRaleway';\n  static const String robotoMono = 'packages\u002F$package\u002FRobotoMono';\n}\n```\n\n#### Usage Example\n\n```dart\nText(\n  'Hi there, I\\'m FlutterGen',\n  style: TextStyle(\n    fontFamily: FontFamily.robotoMono,\n    fontFamilyFallback: const [FontFamily.raleway],\n  ),\n)\n```\n\n[Example of code generated by FlutterGen](https:\u002F\u002Fgithub.com\u002FFlutterGen\u002Fflutter_gen\u002Ftree\u002Fmain\u002Fexamples\u002Fexample\u002Flib\u002Fgen\u002Ffonts.gen.dart)\n\n### Colors\n\n[FlutterGen] supports generating colors from [XML](examples\u002Fexample\u002Fassets\u002Fcolor\u002Fcolors.xml) format files.  \n_Ignore duplicated._\n\n```yaml\n# pubspec.yaml\nflutter_gen:\n  colors:\n    inputs:\n      - assets\u002Fcolor\u002Fcolors.xml\n      - assets\u002Fcolor\u002Fcolors2.xml\n```\n\n[FlutterGen] can generate a [Color](https:\u002F\u002Fapi.flutter.dev\u002Fflutter\u002Fmaterial\u002FColors-class.html) class based on the `name` attribute and the color hex value.\nIf the element has the attribute `type`, then a specially color will be generated.\n\nCurrently supported special color types:\n\n- [MaterialColor](https:\u002F\u002Fapi.flutter.dev\u002Fflutter\u002Fmaterial\u002FMaterialColor-class.html)\n- [MaterialAccentColor](https:\u002F\u002Fapi.flutter.dev\u002Fflutter\u002Fmaterial\u002FMaterialAccentColor-class.html)\n\n> Noticed that there is no official material color generation algorithm. The implementation is based on the [mcg](https:\u002F\u002Fgithub.com\u002Fmbitson\u002Fmcg) project.\n\n```xml\n\u003Ccolor name=\"milk_tea\">#F5CB84\u003C\u002Fcolor>\n\u003Ccolor name=\"cinnamon\" type=\"material\">#955E1C\u003C\u002Fcolor>\n\u003Ccolor name=\"yellow_ocher\" type=\"material material-accent\">#DF9527\u003C\u002Fcolor>\n```\n\nThese configurations will generate **`colors.gen.dart`** under the **`lib\u002Fgen\u002F`** directory by default.\n\n#### Usage Example\n\n```dart\nText(\n  'Hi there, I\\'m FlutterGen',\n  style: TextStyle(\n    color: ColorName.denim,\n  ),\n```\n\n[Example of code generated by FlutterGen](https:\u002F\u002Fgithub.com\u002FFlutterGen\u002Fflutter_gen\u002Ftree\u002Fmain\u002Fexamples\u002Fexample\u002Flib\u002Fgen\u002Fcolors.gen.dart)\n\n## Credits\n\nThe material color generation implementation is based on [mcg](https:\u002F\u002Fgithub.com\u002Fmbitson\u002Fmcg) and [TinyColor](https:\u002F\u002Fgithub.com\u002Fbgrins\u002FTinyColor).\n\n## Issues\n\nPlease file [FlutterGen] specific issues, bugs, or feature requests in our [issue tracker](https:\u002F\u002Fgithub.com\u002FFlutterGen\u002Fflutter_gen\u002Fissues\u002Fnew).\n\nPlugin issues that are not specific to [FlutterGen] can be filed in the [Flutter issue tracker](https:\u002F\u002Fgithub.com\u002Fflutter\u002Fflutter\u002Fissues\u002Fnew).\n\n### Known Issues\n\n#### Bad State: No Element when using build_runner\n\nIf you get an error message like this:\n\n```\n[SEVERE] flutter_gen_runner:flutter_gen_runner on $package$:\n\nBad state: No element\n[SEVERE] Failed after 16.0s\n```\n\nThe you most likely have a customized `build.yaml` to configure the build runner. In that case, all you have to do is to add the `pubspec.yaml` as build source to your `build.yaml`\n\n```yaml\ntargets:\n  $default:\n    sources:\n      include:\n        - pubspec.yaml # add this line\n        - ...\n```\n\nSee #268 for the corresponding issue discussion.\n\n### Error with [internationalization](https:\u002F\u002Fdocs.flutter.dev\u002Fdevelopment\u002Faccessibility-and-localization\u002Finternationalization)\n\nPlease try to remove `generate: true` in your `pubspec.yaml` and disable `synthetic-package` in your `l10n.yaml` like:\n\n```yaml\n# pubspec.yaml\nflutter:\n  generate: true \u003C--- ⚠️Remove this line⚠️\n```\n\n```yaml\n# l10n.yaml\narb-dir: lib\u002Fl10n\ntemplate-arb-file: app_en.arb\noutput-localization-file: app_localizations.dart\nsynthetic-package: false \u003C--- ⚠️Add this line⚠️\n```\n\n## Contributing\n\n**We are looking for co-developers.**\n\nIf you wish to contribute a change to any of the existing plugins in this repo,\nplease review our [contribution guide](https:\u002F\u002Fgithub.com\u002FFlutterGen\u002Fflutter_gen\u002Fblob\u002Fmaster\u002FCONTRIBUTING.md)\nand open a [pull request](https:\u002F\u002Fgithub.com\u002FFlutterGen\u002Fflutter_gen\u002Fpulls).\n\n[build_runner]: https:\u002F\u002Fpub.dev\u002Fpackages\u002Fbuild_runner\n[fluttergen]: https:\u002F\u002Fpub.dev\u002Fpackages\u002Fflutter_gen\n","FlutterGen 是一个用于 Flutter 项目的代码生成工具，旨在为资源、字体、颜色等自动生成类型安全的代码，从而避免使用字符串 API。其核心功能包括基于项目中定义的资源自动生成 Dart 类，使得开发者可以以类型安全的方式引用这些资源，减少因拼写错误导致的运行时错误。技术上，它依赖于 Dart 的 build_runner 来实现代码生成过程，并且支持最新的 pub 工作区特性，增强了多包管理下的开发体验。适用于任何希望提高代码质量和维护性的 Flutter 应用开发场景，特别是对于大型项目或团队协作来说，能显著提升开发效率和减少潜在错误。",2,"2026-06-11 03:22:13","top_language"]