├── .idea ├── .name ├── .gitignore ├── codeStyles │ └── codeStyleConfig.xml ├── runConfigurations │ ├── Run_on_build_runner.xml │ ├── Run_on_flutter_gen_command.xml │ ├── build_runner_build_example.xml │ └── build_runner_build_example_resources.xml └── modules.xml ├── .node-version ├── .pubignore ├── packages ├── command │ ├── LICENSE │ ├── README.md │ ├── .gitignore │ ├── CHANGELOG.md │ ├── dart_test.yaml │ ├── analysis_options.yaml │ ├── test │ │ └── deprecated_configs.yaml │ ├── example │ │ └── lib │ │ │ └── gen │ │ │ └── fonts.gen.dart │ ├── pubspec.yaml │ ├── flutter_gen.iml │ └── bin │ │ └── flutter_gen_command.dart ├── core │ ├── LICENSE │ ├── README.md │ ├── CHANGELOG.md │ ├── dart_test.yaml │ ├── test_resources │ │ ├── pubspec_empty.yaml │ │ ├── assets │ │ │ ├── images │ │ │ │ ├── chip2.jpg │ │ │ │ ├── profile.jpg │ │ │ │ ├── profile.png │ │ │ │ ├── icons │ │ │ │ │ ├── invalid.svg │ │ │ │ │ └── fuchsia.svg │ │ │ │ ├── chip1.jpg │ │ │ │ ├── logo.png │ │ │ │ ├── 2.0x │ │ │ │ │ ├── chip1.jpg │ │ │ │ │ ├── chip2.jpg │ │ │ │ │ ├── logo.png │ │ │ │ │ └── profile.jpg │ │ │ │ ├── 3.0x │ │ │ │ │ ├── chip1.jpg │ │ │ │ │ ├── chip2.jpg │ │ │ │ │ ├── logo.png │ │ │ │ │ └── profile.jpg │ │ │ │ ├── chip3 │ │ │ │ │ └── chip3.jpg │ │ │ │ ├── chip4 │ │ │ │ │ └── chip4.jpg │ │ │ │ └── animated │ │ │ │ │ └── emoji_hugging_face.webp │ │ │ ├── unknown │ │ │ │ ├── dummy.DS_Store │ │ │ │ └── unknown_mime_type.bk │ │ │ ├── json │ │ │ │ ├── list.json │ │ │ │ └── map.json │ │ │ ├── flare │ │ │ │ └── Penguin.flr │ │ │ ├── lottie │ │ │ │ ├── cat_cat.tgs │ │ │ │ ├── XuiIZ9X1Rf.lottie │ │ │ │ ├── missing_layers.json │ │ │ │ └── spinning_carrousel.zip │ │ │ ├── movie │ │ │ │ └── the_earth.mp4 │ │ │ ├── rive │ │ │ │ └── vehicles.riv │ │ │ ├── fonts │ │ │ │ ├── Raleway-Italic.ttf │ │ │ │ ├── Raleway-Regular.ttf │ │ │ │ ├── RobotoMono-Bold.ttf │ │ │ │ └── RobotoMono-Regular.ttf │ │ │ ├── deferred_component │ │ │ │ └── images │ │ │ │ │ ├── chip1.jpg │ │ │ │ │ └── component_logo.png │ │ │ └── color │ │ │ │ ├── colors2.xml │ │ │ │ └── colors.xml │ │ ├── CHANGELOG.md │ │ ├── pubspec_deprecated_line_length.yaml │ │ ├── pictures │ │ │ └── chip5.jpg │ │ ├── build_empty.yaml │ │ ├── pubspec_colors_no_inputs.yaml │ │ ├── pubspec_fonts_no_family.yaml │ │ ├── pubspec_colors_no_inputs_list.yaml │ │ ├── pubspec_only_flutter_gen_value.yaml │ │ ├── pubspec_unknown_mime_type.yaml │ │ ├── build_assets.yaml │ │ ├── pubspec_assets_no_list.yaml │ │ ├── pubspec_assets_rive_integrations.yaml │ │ ├── deprecated_configs.yaml │ │ ├── pubspec_assets_change_class_name.yaml │ │ ├── pubspec_colors_change_class_name.yaml │ │ ├── pubspec_ignore_files.yaml │ │ ├── build_runner_assets.yaml │ │ ├── pubspec_colors.yaml │ │ ├── pubspec_only_flutter_value.yaml │ │ ├── pubspec_assets_lottie_integrations.yaml │ │ ├── pubspec_assets_package_parameter_disable_null_safety.yaml │ │ ├── pubspec_assets_svg_integrations.yaml │ │ ├── pubspec_generation_disabled.yaml │ │ ├── pubspec_assets_directory_path.yaml │ │ ├── pubspec_assets_package_parameter.yaml │ │ ├── pubspec_fonts_change_class_name.yaml │ │ ├── pubspec_wrong_output_path.yaml │ │ ├── pubspec_fonts_package_parameter.yaml │ │ ├── pubspec_no_settings.yaml │ │ ├── pubspec_wrong_line_length.yaml │ │ ├── pubspec_change_output_path.yaml │ │ ├── pubspec_assets_directory_path_with_package_parameter.yaml │ │ ├── pubspec_assets_no_integrations.yaml │ │ ├── pubspec_assets_no_image_integration.yaml │ │ ├── actual_data │ │ │ ├── fonts_change_output_path.gen.dart │ │ │ ├── fonts_only_flutter_value.gen.dart │ │ │ ├── fonts_wrong_output_path.gen.dart │ │ │ ├── fonts_fonts_change_class_name.gen.dart │ │ │ ├── assets_ignore_files.gen.dart │ │ │ ├── fonts_fonts_package_parameter.gen.dart │ │ │ ├── fonts_fonts.gen.dart │ │ │ ├── fonts_normal.gen.dart │ │ │ ├── assets_unknown_mime_type.gen.dart │ │ │ ├── assets_assets_rive_integrations.gen.dart │ │ │ ├── colors_change_output_path.gen.dart │ │ │ ├── colors_wrong_output_path.gen.dart │ │ │ ├── colors_only_flutter_gen_value.gen.dart │ │ │ └── colors_colors_change_class_name.gen.dart │ │ ├── pubspec_assets_camel_case.yaml │ │ ├── pubspec_assets_snake_case.yaml │ │ ├── pubspec_assets_exclude_files.yaml │ │ ├── pubspec_assets_flavored.yaml │ │ ├── pubspec_assets.yaml │ │ ├── pubspec_fonts.yaml │ │ ├── pubspec_assets_flavored_duplicate_entry.yaml │ │ ├── pubspec_assets_parse_metadata.yaml │ │ ├── pubspec_assets_deferred_components.yaml │ │ └── pubspec_normal.yaml │ ├── lib │ │ ├── utils │ │ │ ├── file.dart │ │ │ ├── log.dart │ │ │ ├── error.dart │ │ │ ├── cast.dart │ │ │ ├── formatter.dart │ │ │ ├── map.dart │ │ │ └── string.dart │ │ ├── version.gen.dart │ │ ├── settings │ │ │ ├── color_path.dart │ │ │ ├── import.dart │ │ │ ├── flavored_asset.dart │ │ │ └── config_default.dart │ │ └── generators │ │ │ ├── generator_helper.dart │ │ │ ├── integrations │ │ │ ├── rive_integration.dart │ │ │ └── integration.dart │ │ │ └── fonts_generator.dart │ ├── analysis_options.yaml │ ├── build.yaml │ ├── example │ │ └── lib │ │ │ └── gen │ │ │ └── fonts.gen.dart │ ├── flutter_gen_core.iml │ ├── pubspec.yaml │ ├── test │ │ ├── fonts_gen_test.dart │ │ └── colors_gen_test.dart │ └── scripts │ │ └── generate_facts.dart └── runner │ ├── LICENSE │ ├── README.md │ ├── CHANGELOG.md │ ├── analysis_options.yaml │ ├── build.yaml │ ├── example │ └── lib │ │ └── gen │ │ └── fonts.gen.dart │ ├── pubspec.yaml │ └── flutter_gen_runner.iml ├── .tool-versions ├── examples ├── example │ ├── assets │ │ ├── images │ │ │ ├── chip2.jpg │ │ │ ├── profile.jpg │ │ │ ├── profile.png │ │ │ ├── chip1.jpg │ │ │ ├── logo.png │ │ │ ├── 2.0x │ │ │ │ ├── chip1.jpg │ │ │ │ ├── chip2.jpg │ │ │ │ ├── logo.png │ │ │ │ └── profile.jpg │ │ │ ├── 3.0x │ │ │ │ ├── chip1.jpg │ │ │ │ ├── chip2.jpg │ │ │ │ ├── logo.png │ │ │ │ └── profile.jpg │ │ │ ├── chip3 │ │ │ │ └── chip3.jpg │ │ │ ├── chip4 │ │ │ │ └── chip4.jpg │ │ │ └── icons │ │ │ │ └── fuchsia.svg │ │ ├── mix │ │ │ ├── dummy.DS_Store │ │ │ ├── unknown_mime_type.bk │ │ │ └── aaa.jpg │ │ ├── unknown │ │ │ ├── dummy.DS_Store │ │ │ ├── README.md │ │ │ ├── CHANGELOG.md │ │ │ └── unknown_mime_type.bk │ │ ├── json │ │ │ ├── list.json │ │ │ └── map.json │ │ ├── lottie │ │ │ ├── cat.tgs │ │ │ ├── wrong │ │ │ │ └── dummy.zip │ │ │ ├── XuiIZ9X1Rf.lottie │ │ │ └── spinning_carrousel.zip │ │ ├── flare │ │ │ └── Penguin.flr │ │ ├── rive │ │ │ └── vehicles.riv │ │ ├── movie │ │ │ └── the_earth.mp4 │ │ ├── fonts │ │ │ ├── Raleway-Italic.ttf │ │ │ ├── Raleway-Regular.ttf │ │ │ ├── RobotoMono-Bold.ttf │ │ │ └── RobotoMono-Regular.ttf │ │ └── color │ │ │ ├── colors2.xml │ │ │ └── colors.xml │ ├── .gitignore │ ├── analysis_options.yaml │ ├── ios │ │ ├── Runner │ │ │ ├── Runner-Bridging-Header.h │ │ │ ├── Assets.xcassets │ │ │ │ ├── LaunchImage.imageset │ │ │ │ │ ├── LaunchImage.png │ │ │ │ │ ├── LaunchImage@2x.png │ │ │ │ │ ├── LaunchImage@3x.png │ │ │ │ │ ├── README.md │ │ │ │ │ └── Contents.json │ │ │ │ └── AppIcon.appiconset │ │ │ │ │ ├── Icon-App-20x20@1x.png │ │ │ │ │ ├── Icon-App-20x20@2x.png │ │ │ │ │ ├── Icon-App-20x20@3x.png │ │ │ │ │ ├── Icon-App-29x29@1x.png │ │ │ │ │ ├── Icon-App-29x29@2x.png │ │ │ │ │ ├── Icon-App-29x29@3x.png │ │ │ │ │ ├── Icon-App-40x40@1x.png │ │ │ │ │ ├── Icon-App-40x40@2x.png │ │ │ │ │ ├── Icon-App-40x40@3x.png │ │ │ │ │ ├── Icon-App-60x60@2x.png │ │ │ │ │ ├── Icon-App-60x60@3x.png │ │ │ │ │ ├── Icon-App-76x76@1x.png │ │ │ │ │ ├── Icon-App-76x76@2x.png │ │ │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ │ │ ├── Icon-App-83.5x83.5@2x.png │ │ │ │ │ └── Contents.json │ │ │ ├── AppDelegate.swift │ │ │ ├── Base.lproj │ │ │ │ ├── Main.storyboard │ │ │ │ └── LaunchScreen.storyboard │ │ │ └── Info.plist │ │ ├── Flutter │ │ │ ├── Debug.xcconfig │ │ │ ├── Release.xcconfig │ │ │ └── AppFrameworkInfo.plist │ │ ├── Runner.xcodeproj │ │ │ └── project.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcshareddata │ │ │ │ ├── WorkspaceSettings.xcsettings │ │ │ │ └── IDEWorkspaceChecks.plist │ │ ├── Runner.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ ├── WorkspaceSettings.xcsettings │ │ │ │ └── IDEWorkspaceChecks.plist │ │ ├── firebase_app_id_file.json │ │ ├── .gitignore │ │ └── Podfile │ ├── web │ │ ├── favicon.png │ │ ├── icons │ │ │ ├── Icon-192.png │ │ │ ├── Icon-512.png │ │ │ ├── Icon-maskable-192.png │ │ │ └── Icon-maskable-512.png │ │ ├── manifest.json │ │ └── index.html │ ├── pictures │ │ └── chip5.jpg │ ├── assets-extern │ │ └── logo.png │ ├── macos │ │ ├── Runner │ │ │ ├── Configs │ │ │ │ ├── Debug.xcconfig │ │ │ │ ├── Release.xcconfig │ │ │ │ ├── Warnings.xcconfig │ │ │ │ └── AppInfo.xcconfig │ │ │ ├── Assets.xcassets │ │ │ │ └── AppIcon.appiconset │ │ │ │ │ ├── app_icon_16.png │ │ │ │ │ ├── app_icon_32.png │ │ │ │ │ ├── app_icon_64.png │ │ │ │ │ ├── app_icon_1024.png │ │ │ │ │ ├── app_icon_128.png │ │ │ │ │ ├── app_icon_256.png │ │ │ │ │ ├── app_icon_512.png │ │ │ │ │ └── Contents.json │ │ │ ├── AppDelegate.swift │ │ │ ├── Release.entitlements │ │ │ ├── DebugProfile.entitlements │ │ │ ├── MainFlutterWindow.swift │ │ │ └── Info.plist │ │ ├── Flutter │ │ │ ├── Flutter-Debug.xcconfig │ │ │ ├── Flutter-Release.xcconfig │ │ │ └── GeneratedPluginRegistrant.swift │ │ ├── Runner.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ ├── Runner.xcodeproj │ │ │ └── project.xcworkspace │ │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ ├── .gitignore │ │ └── Podfile │ ├── android │ │ ├── gradle.properties │ │ ├── app │ │ │ ├── src │ │ │ │ ├── main │ │ │ │ │ ├── res │ │ │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ │ ├── drawable │ │ │ │ │ │ │ └── launch_background.xml │ │ │ │ │ │ ├── drawable-v21 │ │ │ │ │ │ │ └── launch_background.xml │ │ │ │ │ │ ├── values │ │ │ │ │ │ │ └── styles.xml │ │ │ │ │ │ └── values-night │ │ │ │ │ │ │ └── styles.xml │ │ │ │ │ ├── kotlin │ │ │ │ │ │ └── com │ │ │ │ │ │ │ └── example │ │ │ │ │ │ │ └── example │ │ │ │ │ │ │ └── MainActivity.kt │ │ │ │ │ └── AndroidManifest.xml │ │ │ │ ├── debug │ │ │ │ │ └── AndroidManifest.xml │ │ │ │ └── profile │ │ │ │ │ └── AndroidManifest.xml │ │ │ ├── google-services.json │ │ │ └── build.gradle │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ └── gradle-wrapper.properties │ │ ├── settings.gradle │ │ └── build.gradle │ ├── README.md │ ├── .idea │ │ ├── runConfigurations │ │ │ └── main_dart.xml │ │ ├── modules.xml │ │ ├── libraries │ │ │ ├── KotlinJavaRuntime.xml │ │ │ └── Dart_SDK.xml │ │ └── workspace.xml │ ├── .metadata │ ├── lib │ │ └── gen │ │ │ └── fonts.gen.dart │ ├── example.iml │ ├── test │ │ └── svg_integrations_test.dart │ └── pubspec.yaml └── example_resources │ ├── assets │ ├── unknown │ │ └── unknown_mime_type.bk │ ├── images │ │ ├── cat.tgs │ │ ├── skills.riv │ │ ├── favorite.flr │ │ ├── flutter3.jpg │ │ └── dart.svg │ └── color │ │ └── colors.xml │ ├── README.md │ ├── lib │ └── gen │ │ └── colors.gen.dart │ ├── pubspec.yaml │ └── example_resources.iml ├── .github ├── CODEOWNERS ├── FUNDING.yml ├── workflows │ ├── publish.yml │ ├── renovate.yml │ └── build.yml ├── PULL_REQUEST_TEMPLATE.md └── ISSUE_TEMPLATE │ ├── feature_request.yml │ └── bug_report.yml ├── art └── logo.png ├── .husky └── pre-commit ├── .gitattributes ├── pubspec.yaml ├── prettier.config.js ├── .prettierignore ├── scripts └── coverage.sh ├── codecov.yml ├── renovate.json ├── package.json ├── fluttergen.iml ├── .vscode └── launch.json ├── LICENSE ├── analysis_options.yaml ├── CONTRIBUTING.md └── .gitignore /.idea/.name: -------------------------------------------------------------------------------- 1 | FlutterGen -------------------------------------------------------------------------------- /.node-version: -------------------------------------------------------------------------------- 1 | 22.21.1 2 | -------------------------------------------------------------------------------- /.pubignore: -------------------------------------------------------------------------------- 1 | test_resources/ 2 | -------------------------------------------------------------------------------- /packages/command/LICENSE: -------------------------------------------------------------------------------- 1 | ../../LICENSE -------------------------------------------------------------------------------- /packages/core/LICENSE: -------------------------------------------------------------------------------- 1 | ../../LICENSE -------------------------------------------------------------------------------- /packages/core/README.md: -------------------------------------------------------------------------------- 1 | ../../README.md -------------------------------------------------------------------------------- /packages/runner/LICENSE: -------------------------------------------------------------------------------- 1 | ../../LICENSE -------------------------------------------------------------------------------- /.tool-versions: -------------------------------------------------------------------------------- 1 | flutter 3.35.2-stable 2 | -------------------------------------------------------------------------------- /examples/example/assets/images/chip2.jpg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/example/assets/images/profile.jpg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/example/assets/images/profile.png: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/example/assets/mix/dummy.DS_Store: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/command/README.md: -------------------------------------------------------------------------------- 1 | ../../README.md -------------------------------------------------------------------------------- /packages/runner/README.md: -------------------------------------------------------------------------------- 1 | ../../README.md -------------------------------------------------------------------------------- /examples/example/.gitignore: -------------------------------------------------------------------------------- 1 | **/build/ 2 | 3 | -------------------------------------------------------------------------------- /examples/example/assets/unknown/dummy.DS_Store: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/command/.gitignore: -------------------------------------------------------------------------------- 1 | test/lib/gen/ 2 | -------------------------------------------------------------------------------- /packages/command/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ../../CHANGELOG.md -------------------------------------------------------------------------------- /packages/core/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ../../CHANGELOG.md -------------------------------------------------------------------------------- /packages/core/dart_test.yaml: -------------------------------------------------------------------------------- 1 | concurrency: 1 2 | -------------------------------------------------------------------------------- /packages/core/test_resources/pubspec_empty.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/runner/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ../../CHANGELOG.md -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @wasabeef @AlexV525 @lcdsmao 2 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: [wasabeef, AlexV525] 2 | -------------------------------------------------------------------------------- /packages/command/dart_test.yaml: -------------------------------------------------------------------------------- 1 | concurrency: 1 2 | -------------------------------------------------------------------------------- /packages/core/test_resources/assets/images/chip2.jpg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/core/test_resources/assets/images/profile.jpg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/core/test_resources/assets/images/profile.png: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/core/test_resources/assets/unknown/dummy.DS_Store: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/example/assets/unknown/README.md: -------------------------------------------------------------------------------- 1 | This is the README.md 2 | -------------------------------------------------------------------------------- /examples/example/assets/unknown/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | This is the CHANGELOG.md 2 | -------------------------------------------------------------------------------- /packages/core/test_resources/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | This is the CHANGELOG.md 2 | -------------------------------------------------------------------------------- /art/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/art/logo.png -------------------------------------------------------------------------------- /examples/example/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: ../../analysis_options.yaml 2 | -------------------------------------------------------------------------------- /examples/example/assets/json/list.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": "ABC42" 4 | } 5 | ] 6 | -------------------------------------------------------------------------------- /examples/example/assets/mix/unknown_mime_type.bk: -------------------------------------------------------------------------------- 1 | This file is UNKNOWN MIME TYPE FILE. 2 | -------------------------------------------------------------------------------- /examples/example/assets/unknown/unknown_mime_type.bk: -------------------------------------------------------------------------------- 1 | This file is UNKNOWN MIME TYPE FILE. 2 | -------------------------------------------------------------------------------- /examples/example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /examples/example_resources/assets/unknown/unknown_mime_type.bk: -------------------------------------------------------------------------------- 1 | This file is UNKNOWN MIME TYPE FILE. 2 | -------------------------------------------------------------------------------- /packages/core/lib/utils/file.dart: -------------------------------------------------------------------------------- 1 | typedef FileWriter = void Function(String contents, String path); 2 | -------------------------------------------------------------------------------- /packages/core/test_resources/assets/images/icons/invalid.svg: -------------------------------------------------------------------------------- 1 | is not a valid SVG file 2 | -------------------------------------------------------------------------------- /packages/core/test_resources/assets/json/list.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": "ABC42" 4 | } 5 | ] 6 | -------------------------------------------------------------------------------- /packages/core/test_resources/assets/unknown/unknown_mime_type.bk: -------------------------------------------------------------------------------- 1 | This file is UNKNOWN MIME TYPE FILE. 2 | -------------------------------------------------------------------------------- /packages/core/test_resources/pubspec_deprecated_line_length.yaml: -------------------------------------------------------------------------------- 1 | flutter_gen: 2 | line_length: 120 3 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | pnpm lint-staged --allow-empty 5 | -------------------------------------------------------------------------------- /examples/example/assets/json/map.json: -------------------------------------------------------------------------------- 1 | { 2 | "fruit": "Apple", 3 | "size": "Large", 4 | "color": "Red" 5 | } 6 | -------------------------------------------------------------------------------- /packages/core/lib/utils/log.dart: -------------------------------------------------------------------------------- 1 | import 'package:logging/logging.dart'; 2 | 3 | final log = Logger('FlutterGen'); 4 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | examples/**/lib/gen/* linguist-generated=false 2 | test_resources/actual_data/* linguist-generated=false 3 | -------------------------------------------------------------------------------- /examples/example/web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/web/favicon.png -------------------------------------------------------------------------------- /examples/example/assets/mix/aaa.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/assets/mix/aaa.jpg -------------------------------------------------------------------------------- /examples/example/pictures/chip5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/pictures/chip5.jpg -------------------------------------------------------------------------------- /packages/core/lib/version.gen.dart: -------------------------------------------------------------------------------- 1 | /// DO NOT MODIFY BY HAND, Generated by version_gen 2 | String packageVersion = '5.12.0'; 3 | -------------------------------------------------------------------------------- /packages/core/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: ../../analysis_options.yaml 2 | 3 | analyzer: 4 | exclude: 5 | - 'example/**' 6 | -------------------------------------------------------------------------------- /packages/core/test_resources/assets/json/map.json: -------------------------------------------------------------------------------- 1 | { 2 | "fruit": "Apple", 3 | "size": "Large", 4 | "color": "Red" 5 | } 6 | -------------------------------------------------------------------------------- /examples/example/assets-extern/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/assets-extern/logo.png -------------------------------------------------------------------------------- /examples/example/assets/images/chip1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/assets/images/chip1.jpg -------------------------------------------------------------------------------- /examples/example/assets/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/assets/images/logo.png -------------------------------------------------------------------------------- /examples/example/assets/lottie/cat.tgs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/assets/lottie/cat.tgs -------------------------------------------------------------------------------- /examples/example/macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /examples/example/web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/web/icons/Icon-192.png -------------------------------------------------------------------------------- /examples/example/web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/web/icons/Icon-512.png -------------------------------------------------------------------------------- /packages/command/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: ../../analysis_options.yaml 2 | 3 | analyzer: 4 | exclude: 5 | - 'example/**' 6 | -------------------------------------------------------------------------------- /packages/runner/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: ../../analysis_options.yaml 2 | 3 | analyzer: 4 | exclude: 5 | - 'example/**' 6 | -------------------------------------------------------------------------------- /examples/example/assets/flare/Penguin.flr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/assets/flare/Penguin.flr -------------------------------------------------------------------------------- /examples/example/assets/rive/vehicles.riv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/assets/rive/vehicles.riv -------------------------------------------------------------------------------- /examples/example/macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /examples/example/assets/images/2.0x/chip1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/assets/images/2.0x/chip1.jpg -------------------------------------------------------------------------------- /examples/example/assets/images/2.0x/chip2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/assets/images/2.0x/chip2.jpg -------------------------------------------------------------------------------- /examples/example/assets/images/2.0x/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/assets/images/2.0x/logo.png -------------------------------------------------------------------------------- /examples/example/assets/images/3.0x/chip1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/assets/images/3.0x/chip1.jpg -------------------------------------------------------------------------------- /examples/example/assets/images/3.0x/chip2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/assets/images/3.0x/chip2.jpg -------------------------------------------------------------------------------- /examples/example/assets/images/3.0x/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/assets/images/3.0x/logo.png -------------------------------------------------------------------------------- /examples/example/assets/movie/the_earth.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/assets/movie/the_earth.mp4 -------------------------------------------------------------------------------- /examples/example/assets/images/2.0x/profile.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/assets/images/2.0x/profile.jpg -------------------------------------------------------------------------------- /examples/example/assets/images/3.0x/profile.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/assets/images/3.0x/profile.jpg -------------------------------------------------------------------------------- /examples/example/assets/images/chip3/chip3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/assets/images/chip3/chip3.jpg -------------------------------------------------------------------------------- /examples/example/assets/images/chip4/chip4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/assets/images/chip4/chip4.jpg -------------------------------------------------------------------------------- /examples/example/assets/lottie/wrong/dummy.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/assets/lottie/wrong/dummy.zip -------------------------------------------------------------------------------- /packages/core/test_resources/pictures/chip5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/packages/core/test_resources/pictures/chip5.jpg -------------------------------------------------------------------------------- /examples/example/assets/fonts/Raleway-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/assets/fonts/Raleway-Italic.ttf -------------------------------------------------------------------------------- /examples/example/assets/fonts/Raleway-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/assets/fonts/Raleway-Regular.ttf -------------------------------------------------------------------------------- /examples/example/assets/fonts/RobotoMono-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/assets/fonts/RobotoMono-Bold.ttf -------------------------------------------------------------------------------- /examples/example/assets/lottie/XuiIZ9X1Rf.lottie: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/assets/lottie/XuiIZ9X1Rf.lottie -------------------------------------------------------------------------------- /examples/example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /examples/example/web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /examples/example/web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /examples/example_resources/assets/images/cat.tgs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example_resources/assets/images/cat.tgs -------------------------------------------------------------------------------- /examples/example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.enableR8=true 3 | android.useAndroidX=true 4 | android.enableJetifier=false 5 | -------------------------------------------------------------------------------- /examples/example/assets/fonts/RobotoMono-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/assets/fonts/RobotoMono-Regular.ttf -------------------------------------------------------------------------------- /examples/example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /examples/example_resources/assets/images/skills.riv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example_resources/assets/images/skills.riv -------------------------------------------------------------------------------- /packages/core/test_resources/assets/images/chip1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/packages/core/test_resources/assets/images/chip1.jpg -------------------------------------------------------------------------------- /packages/core/test_resources/assets/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/packages/core/test_resources/assets/images/logo.png -------------------------------------------------------------------------------- /packages/core/test_resources/build_empty.yaml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | targets: 4 | $default: 5 | builders: 6 | flutter_gen_runner: 7 | options: 8 | -------------------------------------------------------------------------------- /examples/example/assets/lottie/spinning_carrousel.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/assets/lottie/spinning_carrousel.zip -------------------------------------------------------------------------------- /examples/example_resources/assets/images/favorite.flr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example_resources/assets/images/favorite.flr -------------------------------------------------------------------------------- /examples/example_resources/assets/images/flutter3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example_resources/assets/images/flutter3.jpg -------------------------------------------------------------------------------- /packages/core/test_resources/assets/flare/Penguin.flr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/packages/core/test_resources/assets/flare/Penguin.flr -------------------------------------------------------------------------------- /packages/core/test_resources/assets/lottie/cat_cat.tgs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/packages/core/test_resources/assets/lottie/cat_cat.tgs -------------------------------------------------------------------------------- /packages/core/test_resources/assets/movie/the_earth.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/packages/core/test_resources/assets/movie/the_earth.mp4 -------------------------------------------------------------------------------- /packages/core/test_resources/assets/rive/vehicles.riv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/packages/core/test_resources/assets/rive/vehicles.riv -------------------------------------------------------------------------------- /packages/core/test_resources/pubspec_colors_no_inputs.yaml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | flutter_gen: 4 | output: lib/gen/ # Optional (default: lib/gen/) 5 | 6 | colors: 7 | -------------------------------------------------------------------------------- /packages/core/test_resources/assets/images/2.0x/chip1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/packages/core/test_resources/assets/images/2.0x/chip1.jpg -------------------------------------------------------------------------------- /packages/core/test_resources/assets/images/2.0x/chip2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/packages/core/test_resources/assets/images/2.0x/chip2.jpg -------------------------------------------------------------------------------- /packages/core/test_resources/assets/images/2.0x/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/packages/core/test_resources/assets/images/2.0x/logo.png -------------------------------------------------------------------------------- /packages/core/test_resources/assets/images/3.0x/chip1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/packages/core/test_resources/assets/images/3.0x/chip1.jpg -------------------------------------------------------------------------------- /packages/core/test_resources/assets/images/3.0x/chip2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/packages/core/test_resources/assets/images/3.0x/chip2.jpg -------------------------------------------------------------------------------- /packages/core/test_resources/assets/images/3.0x/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/packages/core/test_resources/assets/images/3.0x/logo.png -------------------------------------------------------------------------------- /packages/core/test_resources/assets/fonts/Raleway-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/packages/core/test_resources/assets/fonts/Raleway-Italic.ttf -------------------------------------------------------------------------------- /packages/core/test_resources/assets/images/2.0x/profile.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/packages/core/test_resources/assets/images/2.0x/profile.jpg -------------------------------------------------------------------------------- /packages/core/test_resources/assets/images/3.0x/profile.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/packages/core/test_resources/assets/images/3.0x/profile.jpg -------------------------------------------------------------------------------- /packages/core/test_resources/assets/images/chip3/chip3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/packages/core/test_resources/assets/images/chip3/chip3.jpg -------------------------------------------------------------------------------- /packages/core/test_resources/assets/images/chip4/chip4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/packages/core/test_resources/assets/images/chip4/chip4.jpg -------------------------------------------------------------------------------- /packages/core/test_resources/assets/lottie/XuiIZ9X1Rf.lottie: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/packages/core/test_resources/assets/lottie/XuiIZ9X1Rf.lottie -------------------------------------------------------------------------------- /packages/core/test_resources/assets/fonts/Raleway-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/packages/core/test_resources/assets/fonts/Raleway-Regular.ttf -------------------------------------------------------------------------------- /packages/core/test_resources/assets/fonts/RobotoMono-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/packages/core/test_resources/assets/fonts/RobotoMono-Bold.ttf -------------------------------------------------------------------------------- /packages/core/test_resources/assets/lottie/missing_layers.json: -------------------------------------------------------------------------------- 1 | { 2 | "v": "5.6.7", 3 | "w": "w", 4 | "h": "h", 5 | "ip": "ip", 6 | "op": "op", 7 | "fr": "fr" 8 | } 9 | -------------------------------------------------------------------------------- /packages/core/test_resources/pubspec_fonts_no_family.yaml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | flutter_gen: 4 | output: lib/gen/ # Optional (default: lib/gen/) 5 | 6 | flutter: 7 | fonts: 8 | -------------------------------------------------------------------------------- /examples/example/README.md: -------------------------------------------------------------------------------- 1 | # example 2 | 3 | A sample project using FlutterGen. 4 | 5 | ## Getting Started 6 | 7 | ``` 8 | cd ../flutter_gen 9 | melos bootstrap 10 | ``` 11 | -------------------------------------------------------------------------------- /examples/example/macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /packages/core/test_resources/assets/fonts/RobotoMono-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/packages/core/test_resources/assets/fonts/RobotoMono-Regular.ttf -------------------------------------------------------------------------------- /packages/core/test_resources/assets/lottie/spinning_carrousel.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/packages/core/test_resources/assets/lottie/spinning_carrousel.zip -------------------------------------------------------------------------------- /examples/example/macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /packages/core/test_resources/pubspec_colors_no_inputs_list.yaml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | flutter_gen: 4 | output: lib/gen/ # Optional (default: lib/gen/) 5 | 6 | colors: 7 | inputs: 8 | -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | !/codeStyles/ 2 | !/.name 3 | !/modules.xml 4 | !/runConfigurations/ 5 | 6 | /dictionaries/ 7 | /libraries/ 8 | /runConfigurations/melos_* 9 | /shelf/ 10 | /*.xml 11 | -------------------------------------------------------------------------------- /examples/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /examples/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /examples/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /examples/example_resources/README.md: -------------------------------------------------------------------------------- 1 | # example 2 | 3 | A sample project using FlutterGen. 4 | 5 | ## Getting Started 6 | 7 | ``` 8 | cd ../flutter_gen 9 | melos bootstrap 10 | ``` 11 | -------------------------------------------------------------------------------- /packages/core/test_resources/pubspec_only_flutter_gen_value.yaml: -------------------------------------------------------------------------------- 1 | name: example 2 | 3 | flutter_gen: 4 | output: lib/gen/ 5 | 6 | colors: 7 | inputs: 8 | - assets/color/colors.xml 9 | -------------------------------------------------------------------------------- /.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | -------------------------------------------------------------------------------- /examples/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /examples/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /packages/core/test_resources/assets/deferred_component/images/chip1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/packages/core/test_resources/assets/deferred_component/images/chip1.jpg -------------------------------------------------------------------------------- /packages/core/test_resources/assets/images/animated/emoji_hugging_face.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/packages/core/test_resources/assets/images/animated/emoji_hugging_face.webp -------------------------------------------------------------------------------- /packages/core/test_resources/pubspec_unknown_mime_type.yaml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | flutter_gen: 4 | output: lib/gen/ # Optional (default: lib/gen/) 5 | 6 | flutter: 7 | assets: 8 | - assets/unknown/ 9 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_gen_repository 2 | 3 | environment: 4 | sdk: ^3.4.0 5 | 6 | dev_dependencies: 7 | lints: any # Ignoring the version to allow editing across SDK versions. 8 | melos: ^6.0.0 9 | -------------------------------------------------------------------------------- /examples/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /examples/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /examples/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /examples/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /packages/core/test_resources/assets/deferred_component/images/component_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/packages/core/test_resources/assets/deferred_component/images/component_logo.png -------------------------------------------------------------------------------- /examples/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /examples/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /examples/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /examples/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /examples/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.example 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /examples/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /examples/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /examples/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /examples/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /examples/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /examples/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /examples/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /examples/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /examples/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /examples/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /examples/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /examples/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /examples/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /examples/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /examples/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /packages/command/test/deprecated_configs.yaml: -------------------------------------------------------------------------------- 1 | flutter: 2 | assets: 3 | - assets/ 4 | 5 | flutter_gen: 6 | assets: 7 | enabled: true 8 | style: snake-case 9 | package_parameter_enabled: true 10 | -------------------------------------------------------------------------------- /examples/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /examples/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FlutterGen/flutter_gen/HEAD/examples/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /packages/core/test_resources/build_assets.yaml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | targets: 4 | $default: 5 | builders: 6 | flutter_gen: 7 | options: 8 | output: lib/build_gen/ 9 | line_length: 80 10 | -------------------------------------------------------------------------------- /packages/core/test_resources/pubspec_assets_no_list.yaml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | flutter_gen: 4 | output: lib/gen/ # Optional (default: lib/gen/) 5 | 6 | integrations: 7 | flutter_svg: true 8 | 9 | flutter: 10 | assets: 11 | -------------------------------------------------------------------------------- /examples/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /packages/core/test_resources/pubspec_assets_rive_integrations.yaml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | flutter_gen: 4 | output: lib/gen/ 5 | 6 | integrations: 7 | rive: true 8 | 9 | flutter: 10 | assets: 11 | - assets/rive/vehicles.riv 12 | -------------------------------------------------------------------------------- /packages/core/test_resources/deprecated_configs.yaml: -------------------------------------------------------------------------------- 1 | name: deprecated_configs 2 | 3 | flutter: 4 | assets: 5 | - assets/ 6 | 7 | flutter_gen: 8 | assets: 9 | enabled: true 10 | style: snake-case 11 | package_parameter_enabled: true 12 | -------------------------------------------------------------------------------- /packages/core/lib/utils/error.dart: -------------------------------------------------------------------------------- 1 | class InvalidSettingsException implements Exception { 2 | const InvalidSettingsException(this.message); 3 | 4 | final String message; 5 | 6 | @override 7 | String toString() => 'InvalidSettingsException: $message'; 8 | } 9 | -------------------------------------------------------------------------------- /prettier.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | singleQuote: true, 3 | useTabs: false, 4 | tabWidth: 2, 5 | semi: true, 6 | bracketSpacing: true, 7 | trailingComma: 'all', 8 | arrowParens: 'always', 9 | plugins: ['prettier-plugin-packagejson'], 10 | }; 11 | -------------------------------------------------------------------------------- /examples/example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /packages/core/test_resources/pubspec_assets_change_class_name.yaml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | flutter_gen: 4 | output: lib/gen/ # Optional (default: lib/gen/) 5 | 6 | assets: 7 | outputs: 8 | class_name: MyAssets 9 | 10 | flutter: 11 | assets: 12 | - assets/images 13 | -------------------------------------------------------------------------------- /packages/core/test_resources/pubspec_colors_change_class_name.yaml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | flutter_gen: 4 | output: lib/gen/ # Optional (default: lib/gen/) 5 | 6 | colors: 7 | outputs: 8 | class_name: MyColorName 9 | inputs: 10 | - assets/color/colors.xml 11 | -------------------------------------------------------------------------------- /examples/example/macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @NSApplicationMain 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /examples/example_resources/assets/color/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFFFFF 4 | #000000 5 | #EEEEEE 6 | #979797 7 | 8 | -------------------------------------------------------------------------------- /examples/example/assets/color/colors2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #4D000000 4 | #66000000 5 | #80000000 6 | #99000000 7 | 8 | -------------------------------------------------------------------------------- /packages/core/test_resources/pubspec_ignore_files.yaml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | flutter_gen: 4 | output: lib/gen/ # Optional (default: lib/gen/) 5 | 6 | flutter: 7 | assets: 8 | - assets/unknown/.DS_Store 9 | - assets/unknown/dummy.DS_Store 10 | - assets/unknown/unknown_mime_type.bk.swp 11 | -------------------------------------------------------------------------------- /examples/example/macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/core/test_resources/assets/color/colors2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #4D000000 4 | #66000000 5 | #80000000 6 | #99000000 7 | 8 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | .dart_tool/ 2 | build/ 3 | packages/**/android/ 4 | packages/**/ios/ 5 | packages/**/linux/ 6 | packages/**/macos/ 7 | packages/**/web/ 8 | packages/**/windows/ 9 | examples/**/android/ 10 | examples/**/ios/ 11 | examples/**/linux/ 12 | examples/**/macos/ 13 | examples/**/web/ 14 | examples/**/windows/ 15 | -------------------------------------------------------------------------------- /packages/core/lib/utils/cast.dart: -------------------------------------------------------------------------------- 1 | /// Returns the value if it is the same type as [T], otherwise `null`. 2 | /// 3 | /// [T] must be non-nullable since the return type is nullable. 4 | T? safeCast(Object? value) { 5 | return switch (value) { 6 | final T v => v, 7 | _ => null, 8 | }; 9 | } 10 | -------------------------------------------------------------------------------- /examples/example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /examples/example/macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /packages/core/test_resources/build_runner_assets.yaml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | targets: 4 | $default: 5 | builders: 6 | flutter_gen_runner: 7 | options: 8 | output: lib/build_gen/ 9 | line_length: 120 10 | assets: 11 | outputs: 12 | class_name: BuildAssets 13 | -------------------------------------------------------------------------------- /examples/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /examples/example/ios/firebase_app_id_file.json: -------------------------------------------------------------------------------- 1 | { 2 | "file_generated_by": "FlutterFire CLI", 3 | "purpose": "FirebaseAppID & ProjectID for this Firebase app in this directory", 4 | "GOOGLE_APP_ID": "1:223276840801:ios:b5be85aa3c64059db77720", 5 | "FIREBASE_PROJECT_ID": "flutter-gen-5b267", 6 | "GCM_SENDER_ID": "223276840801" 7 | } 8 | -------------------------------------------------------------------------------- /examples/example/.idea/runConfigurations/main_dart.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | -------------------------------------------------------------------------------- /examples/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/core/test_resources/pubspec_colors.yaml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | environment: 4 | sdk: ^3.6.0 5 | 6 | flutter_gen: 7 | output: lib/gen/ # Optional (default: lib/gen/) 8 | 9 | colors: 10 | inputs: 11 | - assets/color/colors.xml 12 | - assets/color/colors2.xml 13 | - assets/color/colors2.xml # duplicated 14 | -------------------------------------------------------------------------------- /examples/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /examples/example/macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | import rive_common 9 | 10 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 11 | RivePlugin.register(with: registry.registrar(forPlugin: "RivePlugin")) 12 | } 13 | -------------------------------------------------------------------------------- /examples/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /examples/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/core/test_resources/pubspec_only_flutter_value.yaml: -------------------------------------------------------------------------------- 1 | name: example 2 | 3 | flutter: 4 | uses-material-design: true 5 | assets: 6 | - assets/images/ 7 | fonts: 8 | - family: Raleway 9 | fonts: 10 | - asset: assets/fonts/Raleway-Regular.ttf 11 | - asset: assets/fonts/Raleway-Italic.ttf 12 | style: italic 13 | -------------------------------------------------------------------------------- /examples/example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: bbfbf1770cca2da7c82e887e4e4af910034800b6 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /packages/core/test_resources/pubspec_assets_lottie_integrations.yaml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | flutter_gen: 4 | output: lib/gen/ 5 | 6 | integrations: 7 | lottie: true 8 | 9 | flutter: 10 | assets: 11 | - assets/lottie/hamburger_arrow.json 12 | - assets/lottie/spinning_carrousel.zip 13 | - assets/lottie/XuiIZ9X1Rf.lottie 14 | - assets/lottie/cat_cat.tgs 15 | -------------------------------------------------------------------------------- /packages/runner/build.yaml: -------------------------------------------------------------------------------- 1 | targets: 2 | $default: 3 | builders: 4 | flutter_gen_runner: 5 | enabled: true 6 | 7 | builders: 8 | flutter_gen_runner: 9 | import: 'package:flutter_gen_runner/flutter_gen_runner.dart' 10 | builder_factories: ['build'] 11 | build_extensions: { '$package$': ['.gen.dart'] } 12 | auto_apply: dependents 13 | build_to: source 14 | -------------------------------------------------------------------------------- /examples/example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /examples/example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /packages/core/test_resources/pubspec_assets_package_parameter_disable_null_safety.yaml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | flutter_gen: 4 | integrations: 5 | flutter_svg: true 6 | assets: 7 | outputs: 8 | package_parameter_enabled: true 9 | 10 | flutter: 11 | assets: 12 | - assets/images/chip3/chip3.jpg 13 | - assets/images/icons/dart@test.svg 14 | - assets/images/icons/fuchsia.svg 15 | -------------------------------------------------------------------------------- /scripts/coverage.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | set -o pipefail 5 | 6 | # Validate the configurations. 7 | curl --data-binary @codecov.yml https://codecov.io/validate 8 | 9 | DIR="${1}" 10 | cd "${DIR}" || exit 11 | 12 | dart pub global activate coverage 13 | dart run coverage:test_with_coverage --port=9292 14 | format_coverage --lcov --in=coverage --out=coverage.lcov --report-on=lib 15 | -------------------------------------------------------------------------------- /packages/core/test_resources/pubspec_assets_svg_integrations.yaml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | flutter_gen: 4 | output: lib/gen/ 5 | 6 | integrations: 7 | flutter_svg: true 8 | 9 | flutter: 10 | assets: 11 | - assets/images/icons/dart@test.svg 12 | - assets/images/icons/fuchsia.svg 13 | - path: assets/images/icons/kmm.svg 14 | transformers: 15 | - package: vector_graphics_compiler 16 | -------------------------------------------------------------------------------- /packages/core/test_resources/pubspec_generation_disabled.yaml: -------------------------------------------------------------------------------- 1 | flutter_gen: 2 | assets: 3 | enabled: false 4 | fonts: 5 | enabled: false 6 | colors: 7 | enabled: false 8 | inputs: 9 | - assets/color/colors.xml 10 | 11 | flutter: 12 | assets: 13 | - assets/images 14 | fonts: 15 | - family: Raleway 16 | fonts: 17 | - asset: assets/fonts/Raleway-Regular.ttf 18 | -------------------------------------------------------------------------------- /examples/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. 6 | -------------------------------------------------------------------------------- /packages/core/test_resources/pubspec_assets_directory_path.yaml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | flutter_gen: 4 | integrations: 5 | flutter_svg: true 6 | assets: 7 | outputs: 8 | directory_path_enabled: true 9 | 10 | flutter: 11 | assets: 12 | - assets/images/chip3/chip3.jpg 13 | - assets/images/icons/dart@test.svg 14 | - assets/images/icons/fuchsia.svg 15 | - assets/unknown/unknown_mime_type.bk 16 | -------------------------------------------------------------------------------- /packages/core/test_resources/pubspec_assets_package_parameter.yaml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | flutter_gen: 4 | integrations: 5 | flutter_svg: true 6 | assets: 7 | outputs: 8 | package_parameter_enabled: true 9 | 10 | flutter: 11 | assets: 12 | - assets/images/chip3/chip3.jpg 13 | - assets/images/icons/dart@test.svg 14 | - assets/images/icons/fuchsia.svg 15 | - assets/unknown/unknown_mime_type.bk 16 | -------------------------------------------------------------------------------- /packages/core/test_resources/pubspec_fonts_change_class_name.yaml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | flutter_gen: 4 | output: lib/gen/ # Optional (default: lib/gen/) 5 | 6 | fonts: 7 | outputs: 8 | class_name: MyFontFamily 9 | 10 | flutter: 11 | fonts: 12 | - family: Raleway 13 | fonts: 14 | - asset: assets/fonts/Raleway-Regular.ttf 15 | - asset: assets/fonts/Raleway-Italic.ttf 16 | style: italic 17 | -------------------------------------------------------------------------------- /packages/core/test_resources/pubspec_wrong_output_path.yaml: -------------------------------------------------------------------------------- 1 | name: example 2 | 3 | flutter_gen: 4 | output: 5 | 6 | colors: 7 | inputs: 8 | - assets/color/colors.xml 9 | 10 | flutter: 11 | assets: 12 | - assets/images/ 13 | fonts: 14 | - family: Raleway 15 | fonts: 16 | - asset: assets/fonts/Raleway-Regular.ttf 17 | - asset: assets/fonts/Raleway-Italic.ttf 18 | style: italic 19 | -------------------------------------------------------------------------------- /examples/example/assets/color/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFFFFF 4 | #000000 5 | #EEEEEE 6 | #979797 7 | #CF2A2A 8 | #DF9527 9 | 10 | -------------------------------------------------------------------------------- /packages/core/test_resources/pubspec_fonts_package_parameter.yaml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | flutter_gen: 4 | output: lib/gen/ # Optional (default: lib/gen/) 5 | 6 | fonts: 7 | outputs: 8 | package_parameter_enabled: true 9 | 10 | flutter: 11 | fonts: 12 | - family: Raleway 13 | fonts: 14 | - asset: assets/fonts/Raleway-Regular.ttf 15 | - asset: assets/fonts/Raleway-Italic.ttf 16 | style: italic 17 | -------------------------------------------------------------------------------- /packages/core/test_resources/pubspec_no_settings.yaml: -------------------------------------------------------------------------------- 1 | name: example 2 | description: A sample project using FlutterGen. 3 | 4 | publish_to: 'none' 5 | 6 | version: 1.0.0+1 7 | 8 | environment: 9 | sdk: '>=2.9.0 <3.0.0' 10 | flutter: '>=1.20.0' 11 | 12 | dependencies: 13 | flutter: 14 | sdk: flutter 15 | 16 | dev_dependencies: 17 | flutter_test: 18 | sdk: flutter 19 | build_runner: 20 | flutter_gen: 21 | path: ../ 22 | -------------------------------------------------------------------------------- /examples/example/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /examples/example/macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /packages/core/test_resources/assets/color/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFFFFF 4 | #000000 5 | #EEEEEE 6 | #979797 7 | #CF2A2A 8 | #DF9527 9 | 10 | -------------------------------------------------------------------------------- /packages/core/test_resources/pubspec_wrong_line_length.yaml: -------------------------------------------------------------------------------- 1 | name: example 2 | 3 | flutter_gen: 4 | output: lib/gen/ 5 | line_length: aaaa 6 | 7 | colors: 8 | inputs: 9 | - assets/color/colors.xml 10 | 11 | flutter: 12 | assets: 13 | - assets/images/ 14 | fonts: 15 | - family: Raleway 16 | fonts: 17 | - asset: assets/fonts/Raleway-Regular.ttf 18 | - asset: assets/fonts/Raleway-Italic.ttf 19 | style: italic 20 | -------------------------------------------------------------------------------- /packages/core/test_resources/pubspec_change_output_path.yaml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | flutter_gen: 4 | output: lib/aaa/bbb/ccc # Optional (default: lib/gen/) 5 | 6 | colors: 7 | inputs: 8 | - assets/color/colors.xml 9 | 10 | flutter: 11 | assets: 12 | - assets/images/ 13 | fonts: 14 | - family: Raleway 15 | fonts: 16 | - asset: assets/fonts/Raleway-Regular.ttf 17 | - asset: assets/fonts/Raleway-Italic.ttf 18 | style: italic 19 | -------------------------------------------------------------------------------- /packages/core/test_resources/pubspec_assets_directory_path_with_package_parameter.yaml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | flutter_gen: 4 | integrations: 5 | flutter_svg: true 6 | assets: 7 | outputs: 8 | directory_path_enabled: true 9 | package_parameter_enabled: true 10 | 11 | flutter: 12 | assets: 13 | - assets/images/chip3/chip3.jpg 14 | - assets/images/icons/dart@test.svg 15 | - assets/images/icons/fuchsia.svg 16 | - assets/unknown/unknown_mime_type.bk 17 | -------------------------------------------------------------------------------- /packages/core/build.yaml: -------------------------------------------------------------------------------- 1 | targets: 2 | $default: 3 | builders: 4 | json_serializable: 5 | options: 6 | any_map: true 7 | checked: true 8 | create_factory: true 9 | create_to_json: false 10 | disallow_unrecognized_keys: true 11 | explicit_to_json: false 12 | field_rename: none 13 | generic_argument_factories: false 14 | ignore_unannotated: false 15 | include_if_null: true 16 | -------------------------------------------------------------------------------- /examples/example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /examples/example/macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController.init() 7 | let windowFrame = self.frame 8 | self.contentViewController = flutterViewController 9 | self.setFrame(windowFrame, display: true) 10 | 11 | RegisterGeneratedPlugins(registry: flutterViewController) 12 | 13 | super.awakeFromNib() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /.idea/runConfigurations/Run_on_build_runner.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /packages/core/lib/settings/color_path.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:mime/mime.dart' show lookupMimeType; 4 | 5 | /// https://github.com/dart-lang/mime/blob/master/lib/src/default_extension_map.dart 6 | class ColorPath { 7 | const ColorPath(this.path); 8 | 9 | final String path; 10 | 11 | File get file => File(path); 12 | 13 | String? get mime => lookupMimeType(path); 14 | 15 | /// https://api.flutter.dev/flutter/widgets/Image-class.html 16 | bool get isXml => mime == 'application/xml'; 17 | } 18 | -------------------------------------------------------------------------------- /examples/example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /examples/example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /packages/core/test_resources/pubspec_assets_no_integrations.yaml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | flutter_gen: 4 | output: lib/gen/ # Optional (default: lib/gen/) 5 | 6 | flutter: 7 | assets: 8 | - assets/images 9 | - assets/images/chip3/chip3.jpg 10 | - assets/images/chip3/chip3.jpg # duplicated 11 | - assets/images/chip4/ 12 | - assets/images/icons/fuchsia.svg 13 | - assets/images/icons/kmm.svg 14 | - assets/images/icons/paint.svg 15 | - assets/images/icons/dart@test.svg 16 | - assets/json/ 17 | - pictures/chip5.jpg 18 | -------------------------------------------------------------------------------- /examples/example/android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/runConfigurations/Run_on_flutter_gen_command.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/runConfigurations/build_runner_build_example.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | -------------------------------------------------------------------------------- /examples/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/core/lib/settings/import.dart: -------------------------------------------------------------------------------- 1 | import 'package:meta/meta.dart'; 2 | 3 | @immutable 4 | class Import { 5 | const Import(this.import, {this.alias}); 6 | 7 | final String import; 8 | final String? alias; 9 | 10 | @override 11 | bool operator ==(Object other) { 12 | if (identical(this, other)) { 13 | return true; 14 | } 15 | return other is Import && 16 | identical(other.import, import) && 17 | identical(other.alias, alias); 18 | } 19 | 20 | @override 21 | int get hashCode => import.hashCode ^ alias.hashCode; 22 | } 23 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | codecov: 2 | notify: 3 | wait_for_ci: true 4 | require_ci_to_pass: yes 5 | 6 | coverage: 7 | status: 8 | project: 9 | default: 10 | # basic 11 | target: 0% 12 | threshold: 0% 13 | base: auto 14 | # advanced 15 | branches: null 16 | if_no_uploads: error 17 | if_not_found: success 18 | if_ci_failed: error 19 | only_pulls: false 20 | flags: null 21 | paths: null 22 | 23 | ignore: 24 | - 'examples/**/*' 25 | - '**/*.g.dart' 26 | - '**/*.gen.dart' 27 | -------------------------------------------------------------------------------- /.idea/runConfigurations/build_runner_build_example_resources.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | -------------------------------------------------------------------------------- /packages/core/test_resources/pubspec_assets_no_image_integration.yaml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | flutter_gen: 4 | output: lib/gen/ # Optional (default: lib/gen/) 5 | 6 | integrations: 7 | image: false 8 | 9 | flutter: 10 | assets: 11 | - assets/images 12 | - assets/images/chip3/chip3.jpg 13 | - assets/images/chip3/chip3.jpg # duplicated 14 | - assets/images/chip4/ 15 | - assets/images/icons/fuchsia.svg 16 | - assets/images/icons/kmm.svg 17 | - assets/images/icons/paint.svg 18 | - assets/images/icons/dart@test.svg 19 | - assets/json/ 20 | - pictures/chip5.jpg 21 | -------------------------------------------------------------------------------- /packages/core/test_resources/actual_data/fonts_change_output_path.gen.dart: -------------------------------------------------------------------------------- 1 | // dart format width=80 2 | /// GENERATED CODE - DO NOT MODIFY BY HAND 3 | /// ***************************************************** 4 | /// FlutterGen 5 | /// ***************************************************** 6 | 7 | // coverage:ignore-file 8 | // ignore_for_file: type=lint 9 | // ignore_for_file: deprecated_member_use,directives_ordering,implicit_dynamic_list_literal,unnecessary_import 10 | 11 | class FontFamily { 12 | FontFamily._(); 13 | 14 | /// Font family: Raleway 15 | static const String raleway = 'Raleway'; 16 | } 17 | -------------------------------------------------------------------------------- /packages/core/test_resources/actual_data/fonts_only_flutter_value.gen.dart: -------------------------------------------------------------------------------- 1 | // dart format width=80 2 | /// GENERATED CODE - DO NOT MODIFY BY HAND 3 | /// ***************************************************** 4 | /// FlutterGen 5 | /// ***************************************************** 6 | 7 | // coverage:ignore-file 8 | // ignore_for_file: type=lint 9 | // ignore_for_file: deprecated_member_use,directives_ordering,implicit_dynamic_list_literal,unnecessary_import 10 | 11 | class FontFamily { 12 | FontFamily._(); 13 | 14 | /// Font family: Raleway 15 | static const String raleway = 'Raleway'; 16 | } 17 | -------------------------------------------------------------------------------- /packages/core/test_resources/actual_data/fonts_wrong_output_path.gen.dart: -------------------------------------------------------------------------------- 1 | // dart format width=80 2 | /// GENERATED CODE - DO NOT MODIFY BY HAND 3 | /// ***************************************************** 4 | /// FlutterGen 5 | /// ***************************************************** 6 | 7 | // coverage:ignore-file 8 | // ignore_for_file: type=lint 9 | // ignore_for_file: deprecated_member_use,directives_ordering,implicit_dynamic_list_literal,unnecessary_import 10 | 11 | class FontFamily { 12 | FontFamily._(); 13 | 14 | /// Font family: Raleway 15 | static const String raleway = 'Raleway'; 16 | } 17 | -------------------------------------------------------------------------------- /packages/core/test_resources/pubspec_assets_camel_case.yaml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | flutter_gen: 4 | output: lib/gen/ # Optional (default: lib/gen/) 5 | 6 | assets: 7 | outputs: 8 | style: camel-case 9 | 10 | flutter: 11 | assets: 12 | - assets/images 13 | - assets/images/chip3/chip3.jpg 14 | - assets/images/chip3/chip3.jpg # duplicated 15 | - assets/images/chip4/ 16 | - assets/images/icons/fuchsia.svg 17 | - assets/images/icons/kmm.svg 18 | - assets/images/icons/paint.svg 19 | - assets/images/icons/dart@test.svg 20 | - assets/json/ 21 | - pictures/chip5.jpg 22 | -------------------------------------------------------------------------------- /packages/core/test_resources/pubspec_assets_snake_case.yaml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | flutter_gen: 4 | output: lib/gen/ # Optional (default: lib/gen/) 5 | 6 | assets: 7 | outputs: 8 | style: snake-case 9 | 10 | flutter: 11 | assets: 12 | - assets/images 13 | - assets/images/chip3/chip3.jpg 14 | - assets/images/chip3/chip3.jpg # duplicated 15 | - assets/images/chip4/ 16 | - assets/images/icons/fuchsia.svg 17 | - assets/images/icons/kmm.svg 18 | - assets/images/icons/paint.svg 19 | - assets/images/icons/dart@test.svg 20 | - assets/json/ 21 | - pictures/chip5.jpg 22 | -------------------------------------------------------------------------------- /packages/core/test_resources/actual_data/fonts_fonts_change_class_name.gen.dart: -------------------------------------------------------------------------------- 1 | // dart format width=80 2 | /// GENERATED CODE - DO NOT MODIFY BY HAND 3 | /// ***************************************************** 4 | /// FlutterGen 5 | /// ***************************************************** 6 | 7 | // coverage:ignore-file 8 | // ignore_for_file: type=lint 9 | // ignore_for_file: deprecated_member_use,directives_ordering,implicit_dynamic_list_literal,unnecessary_import 10 | 11 | class MyFontFamily { 12 | MyFontFamily._(); 13 | 14 | /// Font family: Raleway 15 | static const String raleway = 'Raleway'; 16 | } 17 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "config:recommended", 4 | "group:monorepos", 5 | ":semanticCommits", 6 | ":semanticCommitTypeAll(upgrade)", 7 | ":semanticCommitScopeDisabled" 8 | ], 9 | "timezone": "Asia/Tokyo", 10 | "schedule": ["* * * * 3"], 11 | "branchConcurrentLimit": 5, 12 | "branchPrefix": "upgrade-renovate-", 13 | "dependencyDashboard": false, 14 | "ignorePaths": [".github/", "examples/**"], 15 | "major": { 16 | "minimumReleaseAge": "30 days" 17 | }, 18 | "minor": { 19 | "minimumReleaseAge": "14 days" 20 | }, 21 | "patch": { 22 | "enabled": false 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/core/example/lib/gen/fonts.gen.dart: -------------------------------------------------------------------------------- 1 | /// GENERATED CODE - DO NOT MODIFY BY HAND 2 | /// ***************************************************** 3 | /// FlutterGen 4 | /// ***************************************************** 5 | 6 | // coverage:ignore-file 7 | // ignore_for_file: type=lint 8 | // ignore_for_file: directives_ordering,unnecessary_import,implicit_dynamic_list_literal,deprecated_member_use 9 | 10 | class MyFontFamily { 11 | MyFontFamily._(); 12 | 13 | /// Font family: Raleway 14 | static const String raleway = 'Raleway'; 15 | 16 | /// Font family: RobotoMono 17 | static const String robotoMono = 'RobotoMono'; 18 | } 19 | -------------------------------------------------------------------------------- /packages/runner/example/lib/gen/fonts.gen.dart: -------------------------------------------------------------------------------- 1 | /// GENERATED CODE - DO NOT MODIFY BY HAND 2 | /// ***************************************************** 3 | /// FlutterGen 4 | /// ***************************************************** 5 | 6 | // coverage:ignore-file 7 | // ignore_for_file: type=lint 8 | // ignore_for_file: directives_ordering,unnecessary_import,implicit_dynamic_list_literal,deprecated_member_use 9 | 10 | class MyFontFamily { 11 | MyFontFamily._(); 12 | 13 | /// Font family: Raleway 14 | static const String raleway = 'Raleway'; 15 | 16 | /// Font family: RobotoMono 17 | static const String robotoMono = 'RobotoMono'; 18 | } 19 | -------------------------------------------------------------------------------- /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: Publish to pub.dev 2 | 3 | on: 4 | push: 5 | tags: 6 | - 'v[0-9]+.[0-9]+.[0-9]+' 7 | workflow_dispatch: 8 | 9 | jobs: 10 | publish: 11 | permissions: 12 | id-token: write 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@v4 16 | - uses: dart-lang/setup-dart@v1 17 | - uses: flutter-actions/setup-flutter@v4.0 18 | - name: Install dependencies 19 | run: dart pub get 20 | - name: Prepare Melos workspace 21 | uses: bluefireteam/melos-action@v3 22 | - name: Publish 23 | run: melos run publish:force --no-select 24 | -------------------------------------------------------------------------------- /packages/command/example/lib/gen/fonts.gen.dart: -------------------------------------------------------------------------------- 1 | /// GENERATED CODE - DO NOT MODIFY BY HAND 2 | /// ***************************************************** 3 | /// FlutterGen 4 | /// ***************************************************** 5 | 6 | // coverage:ignore-file 7 | // ignore_for_file: type=lint 8 | // ignore_for_file: directives_ordering,unnecessary_import,implicit_dynamic_list_literal,deprecated_member_use 9 | 10 | class MyFontFamily { 11 | MyFontFamily._(); 12 | 13 | /// Font family: Raleway 14 | static const String raleway = 'Raleway'; 15 | 16 | /// Font family: RobotoMono 17 | static const String robotoMono = 'RobotoMono'; 18 | } 19 | -------------------------------------------------------------------------------- /examples/example/lib/gen/fonts.gen.dart: -------------------------------------------------------------------------------- 1 | // dart format width=80 2 | /// GENERATED CODE - DO NOT MODIFY BY HAND 3 | /// ***************************************************** 4 | /// FlutterGen 5 | /// ***************************************************** 6 | 7 | // coverage:ignore-file 8 | // ignore_for_file: type=lint 9 | // ignore_for_file: deprecated_member_use,directives_ordering,implicit_dynamic_list_literal,unnecessary_import 10 | 11 | class MyFontFamily { 12 | MyFontFamily._(); 13 | 14 | /// Font family: Raleway 15 | static const String raleway = 'Raleway'; 16 | 17 | /// Font family: RobotoMono 18 | static const String robotoMono = 'RobotoMono'; 19 | } 20 | -------------------------------------------------------------------------------- /packages/core/test_resources/actual_data/assets_ignore_files.gen.dart: -------------------------------------------------------------------------------- 1 | // dart format width=80 2 | 3 | /// GENERATED CODE - DO NOT MODIFY BY HAND 4 | /// ***************************************************** 5 | /// FlutterGen 6 | /// ***************************************************** 7 | 8 | // coverage:ignore-file 9 | // ignore_for_file: type=lint 10 | // ignore_for_file: deprecated_member_use,directives_ordering,implicit_dynamic_list_literal,unnecessary_import 11 | 12 | class $AssetsUnknownGen { 13 | const $AssetsUnknownGen(); 14 | } 15 | 16 | class Assets { 17 | const Assets._(); 18 | 19 | static const $AssetsUnknownGen unknown = $AssetsUnknownGen(); 20 | } 21 | -------------------------------------------------------------------------------- /examples/example/macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /packages/core/test_resources/actual_data/fonts_fonts_package_parameter.gen.dart: -------------------------------------------------------------------------------- 1 | // dart format width=80 2 | /// GENERATED CODE - DO NOT MODIFY BY HAND 3 | /// ***************************************************** 4 | /// FlutterGen 5 | /// ***************************************************** 6 | 7 | // coverage:ignore-file 8 | // ignore_for_file: type=lint 9 | // ignore_for_file: deprecated_member_use,directives_ordering,implicit_dynamic_list_literal,unnecessary_import 10 | 11 | class FontFamily { 12 | FontFamily._(); 13 | 14 | static const String package = 'test'; 15 | 16 | /// Font family: Raleway 17 | static const String raleway = 'packages/$package/Raleway'; 18 | } 19 | -------------------------------------------------------------------------------- /packages/core/test_resources/actual_data/fonts_fonts.gen.dart: -------------------------------------------------------------------------------- 1 | // dart format width=80 2 | /// GENERATED CODE - DO NOT MODIFY BY HAND 3 | /// ***************************************************** 4 | /// FlutterGen 5 | /// ***************************************************** 6 | 7 | // coverage:ignore-file 8 | // ignore_for_file: type=lint 9 | // ignore_for_file: deprecated_member_use,directives_ordering,implicit_dynamic_list_literal,unnecessary_import 10 | 11 | class FontFamily { 12 | FontFamily._(); 13 | 14 | /// Font family: Raleway 15 | static const String raleway = 'Raleway'; 16 | 17 | /// Font family: RobotoMono 18 | static const String robotoMono = 'RobotoMono'; 19 | } 20 | -------------------------------------------------------------------------------- /packages/core/test_resources/actual_data/fonts_normal.gen.dart: -------------------------------------------------------------------------------- 1 | // dart format width=80 2 | /// GENERATED CODE - DO NOT MODIFY BY HAND 3 | /// ***************************************************** 4 | /// FlutterGen 5 | /// ***************************************************** 6 | 7 | // coverage:ignore-file 8 | // ignore_for_file: type=lint 9 | // ignore_for_file: deprecated_member_use,directives_ordering,implicit_dynamic_list_literal,unnecessary_import 10 | 11 | class FontFamily { 12 | FontFamily._(); 13 | 14 | /// Font family: Raleway 15 | static const String raleway = 'Raleway'; 16 | 17 | /// Font family: RobotoMono 18 | static const String robotoMono = 'RobotoMono'; 19 | } 20 | -------------------------------------------------------------------------------- /examples/example/macos/Runner/Configs/AppInfo.xcconfig: -------------------------------------------------------------------------------- 1 | // Application-level settings for the Runner target. 2 | // 3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the 4 | // future. If not, the values below would default to using the project name when this becomes a 5 | // 'flutter create' template. 6 | 7 | // The application's name. By default this is also the title of the Flutter window. 8 | PRODUCT_NAME = example 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2022 com.example. All rights reserved. 15 | -------------------------------------------------------------------------------- /examples/example/.idea/libraries/KotlinJavaRuntime.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /packages/core/test_resources/pubspec_assets_exclude_files.yaml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | flutter_gen: 4 | output: lib/gen/ 5 | 6 | integrations: 7 | flutter_svg: true 8 | 9 | assets: 10 | exclude: 11 | - assets/images/chip3/*.jpg 12 | - assets/images/*.png 13 | - assets/**/icons/* 14 | 15 | flutter: 16 | uses-material-design: true 17 | assets: 18 | - assets/images/ 19 | - assets/images/chip3/chip3.jpg 20 | - assets/images/chip3/chip3.jpg # duplicated 21 | - assets/images/chip4/ 22 | - assets/images/icons/fuchsia.svg 23 | - assets/images/icons/kmm.svg 24 | - assets/images/icons/paint.svg 25 | - assets/images/icons/dart@test.svg 26 | - assets/json/ 27 | - pictures/chip5.jpg 28 | -------------------------------------------------------------------------------- /examples/example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /examples/example/macos/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "flutter_gen", 3 | "private": true, 4 | "author": "wasabeef", 5 | "scripts": { 6 | "format": "prettier --config prettier.config.js --write '**/*.+(md|yml|yaml|json)'", 7 | "prepare": "husky install" 8 | }, 9 | "lint-staged": { 10 | "**/*.+(md|yml|yaml|json)": [ 11 | "pnpm run format" 12 | ], 13 | "!(packages/core/test_resources/actual_data/**/*)*.dart": [ 14 | "melos format", 15 | "dart run packages/core/scripts/generate_facts.dart" 16 | ] 17 | }, 18 | "devDependencies": { 19 | "husky": "8.0.3", 20 | "lint-staged": "^16.0.0", 21 | "prettier": "^3.0.3", 22 | "prettier-plugin-packagejson": "^2.4.5" 23 | }, 24 | "packageManager": "pnpm@10.22.0" 25 | } 26 | -------------------------------------------------------------------------------- /fluttergen.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /packages/core/test_resources/pubspec_assets_flavored.yaml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | flutter_gen: 4 | output: lib/gen/ # Optional (default: lib/gen/) 5 | 6 | integrations: 7 | flutter_svg: true 8 | 9 | flutter: 10 | assets: 11 | - assets/images 12 | - assets/images/chip3/chip3.jpg 13 | - assets/images/chip3/chip3.jpg # duplicated 14 | - assets/images/icons/fuchsia.svg 15 | - assets/images/icons/kmm.svg 16 | - assets/images/icons/paint.svg 17 | - assets/images/icons/dart@test.svg 18 | - assets/json/ 19 | - pictures/chip5.jpg 20 | - assets/flare/ 21 | - assets/movie/ 22 | - assets/unknown/unknown_mime_type.bk 23 | - CHANGELOG.md 24 | - path: assets/images/chip4/ 25 | flavors: 26 | - test 27 | -------------------------------------------------------------------------------- /packages/core/lib/settings/flavored_asset.dart: -------------------------------------------------------------------------------- 1 | class FlavoredAsset { 2 | const FlavoredAsset({ 3 | required this.path, 4 | this.flavors = const {}, 5 | this.transformers = const {}, 6 | }); 7 | 8 | final String path; 9 | final Set flavors; 10 | final Set transformers; 11 | 12 | FlavoredAsset copyWith({ 13 | String? path, 14 | Set? flavors, 15 | Set? transformers, 16 | }) { 17 | return FlavoredAsset( 18 | path: path ?? this.path, 19 | flavors: flavors ?? this.flavors, 20 | transformers: transformers ?? this.transformers, 21 | ); 22 | } 23 | 24 | @override 25 | String toString() => 26 | 'FlavoredAsset(path: $path, flavors: $flavors, transformers: $transformers)'; 27 | } 28 | -------------------------------------------------------------------------------- /packages/core/test_resources/pubspec_assets.yaml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | environment: 4 | sdk: ^3.4.0 5 | 6 | flutter_gen: 7 | output: lib/gen/ # Optional (default: lib/gen/) 8 | line_length: 80 # Optional 9 | 10 | integrations: 11 | flutter_svg: true 12 | 13 | flutter: 14 | assets: 15 | - assets/images 16 | - assets/images/chip3/chip3.jpg 17 | - assets/images/chip3/chip3.jpg # duplicated 18 | - assets/images/chip4/ 19 | - assets/images/icons/fuchsia.svg 20 | - assets/images/icons/kmm.svg 21 | - assets/images/icons/paint.svg 22 | - assets/images/icons/dart@test.svg 23 | - assets/json/ 24 | - pictures/chip5.jpg 25 | - assets/flare/ 26 | - assets/movie/ 27 | - assets/unknown/unknown_mime_type.bk 28 | - CHANGELOG.md 29 | -------------------------------------------------------------------------------- /packages/core/test_resources/pubspec_fonts.yaml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | environment: 4 | sdk: ^3.6.0 5 | 6 | flutter_gen: 7 | output: lib/gen/ # Optional (default: lib/gen/) 8 | 9 | flutter: 10 | fonts: 11 | - family: Raleway 12 | fonts: 13 | - asset: assets/fonts/Raleway-Regular.ttf 14 | - asset: assets/fonts/Raleway-Italic.ttf 15 | style: italic 16 | - family: RobotoMono 17 | fonts: 18 | - asset: assets/fonts/RobotoMono-Regular.ttf 19 | - asset: assets/fonts/RobotoMono-Bold.ttf 20 | weight: 700 21 | 22 | # duplicated 23 | - family: RobotoMono 24 | fonts: 25 | - asset: assets/fonts/RobotoMono-Regular.ttf 26 | - asset: assets/fonts/RobotoMono-Bold.ttf 27 | weight: 700 28 | -------------------------------------------------------------------------------- /.github/workflows/renovate.yml: -------------------------------------------------------------------------------- 1 | name: Validate Renovate Config 2 | 3 | on: 4 | push: 5 | paths: 6 | - 'renovate.json' 7 | pull_request: 8 | paths: 9 | - 'renovate.json' 10 | workflow_dispatch: 11 | 12 | jobs: 13 | validate: 14 | runs-on: ubuntu-latest 15 | steps: 16 | - name: Checkout repository 17 | uses: actions/checkout@v4 18 | 19 | - name: Read .node-version 20 | id: node_version 21 | run: echo "version=$(cat .node-version)" >> $GITHUB_ENV 22 | 23 | - name: Setup Node.js 24 | uses: actions/setup-node@v4 25 | with: 26 | node-version: '${{ env.version }}' 27 | 28 | - name: Validate Renovate Config 29 | run: npx --yes --package renovate -- renovate-config-validator 30 | -------------------------------------------------------------------------------- /packages/runner/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_gen_runner 2 | description: The Flutter code generator for your assets, fonts, colors, … — Get rid of all String-based APIs. 3 | version: 5.12.0 4 | homepage: https://github.com/FlutterGen/flutter_gen 5 | repository: https://github.com/FlutterGen/flutter_gen/tree/main/packages/runner 6 | documentation: https://github.com/FlutterGen/flutter_gen 7 | issue_tracker: https://github.com/FlutterGen/flutter_gen/issues 8 | 9 | environment: 10 | sdk: ^3.4.0 11 | 12 | dependencies: 13 | flutter_gen_core: 5.12.0 14 | build: '>=2.0.0 <5.0.0' 15 | collection: ^1.17.0 16 | crypto: ^3.0.0 17 | glob: ^2.0.0 18 | path: ^1.8.0 19 | yaml: ^3.0.0 20 | 21 | dev_dependencies: 22 | lints: any # Ignoring the version to allow editing across SDK versions. 23 | -------------------------------------------------------------------------------- /packages/command/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_gen 2 | description: The Flutter code generator for your assets, fonts, colors, … — Get rid of all String-based APIs. 3 | version: 5.12.0 4 | homepage: https://github.com/FlutterGen/flutter_gen 5 | repository: https://github.com/FlutterGen/flutter_gen/tree/main/packages/command 6 | documentation: https://github.com/FlutterGen/flutter_gen 7 | issue_tracker: https://github.com/FlutterGen/flutter_gen/issues 8 | 9 | environment: 10 | sdk: ^3.4.0 11 | 12 | executables: 13 | fluttergen: flutter_gen_command 14 | 15 | dependencies: 16 | flutter_gen_core: 5.12.0 17 | 18 | args: ^2.0.0 19 | logging: ^1.3.0 20 | 21 | dev_dependencies: 22 | lints: any # Ignoring the version to allow editing across SDK versions. 23 | test: ^1.16.0 24 | test_process: ^2.0.0 25 | -------------------------------------------------------------------------------- /packages/core/flutter_gen_core.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /packages/runner/flutter_gen_runner.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /packages/core/test_resources/pubspec_assets_flavored_duplicate_entry.yaml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | flutter_gen: 4 | output: lib/gen/ # Optional (default: lib/gen/) 5 | 6 | integrations: 7 | flutter_svg: true 8 | 9 | flutter: 10 | assets: 11 | - assets/images 12 | - assets/images/chip3/chip3.jpg 13 | - assets/images/chip3/chip3.jpg # duplicated 14 | - assets/images/icons/fuchsia.svg 15 | - assets/images/icons/kmm.svg 16 | - assets/images/icons/paint.svg 17 | - assets/images/icons/dart@test.svg 18 | - assets/json/ 19 | - pictures/chip5.jpg 20 | - assets/flare/ 21 | - assets/movie/ 22 | - assets/unknown/unknown_mime_type.bk 23 | - CHANGELOG.md 24 | - path: assets/images/chip4/ 25 | flavors: 26 | - test 27 | - path: assets/images/chip4/ 28 | flavors: 29 | - another_test 30 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "Run example on main.dart", 6 | "program": "${workspaceFolder}/examples/example/lib/main.dart", 7 | "request": "launch", 8 | "type": "dart", 9 | "flutterMode": "debug", 10 | "cwd": "examples/example/" 11 | }, 12 | { 13 | "name": "Run on build_runner", 14 | "program": "${workspaceFolder}/examples/example/.dart_tool/build/entrypoint/build.dart", 15 | "request": "launch", 16 | "type": "dart", 17 | "args": ["build"], 18 | "cwd": "examples/example/" 19 | }, 20 | { 21 | "name": "Run on flutter_gen_command", 22 | "program": "${workspaceFolder}/packages/command/bin/flutter_gen_command.dart", 23 | "request": "launch", 24 | "type": "dart", 25 | "cwd": "examples/example/" 26 | } 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /packages/core/test_resources/actual_data/assets_unknown_mime_type.gen.dart: -------------------------------------------------------------------------------- 1 | // dart format width=80 2 | 3 | /// GENERATED CODE - DO NOT MODIFY BY HAND 4 | /// ***************************************************** 5 | /// FlutterGen 6 | /// ***************************************************** 7 | 8 | // coverage:ignore-file 9 | // ignore_for_file: type=lint 10 | // ignore_for_file: deprecated_member_use,directives_ordering,implicit_dynamic_list_literal,unnecessary_import 11 | 12 | class $AssetsUnknownGen { 13 | const $AssetsUnknownGen(); 14 | 15 | /// File path: assets/unknown/unknown_mime_type.bk 16 | String get unknownMimeType => 'assets/unknown/unknown_mime_type.bk'; 17 | 18 | /// List of all assets 19 | List get values => [unknownMimeType]; 20 | } 21 | 22 | class Assets { 23 | const Assets._(); 24 | 25 | static const $AssetsUnknownGen unknown = $AssetsUnknownGen(); 26 | } 27 | -------------------------------------------------------------------------------- /packages/core/test_resources/pubspec_assets_parse_metadata.yaml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | flutter_gen: 4 | output: lib/gen/ # Optional (default: lib/gen/) 5 | parse_metadata: true # Optional (default: false) 6 | 7 | images: 8 | parse_animation: true # Optional (default: false) 9 | 10 | integrations: 11 | flutter_svg: true 12 | 13 | flutter: 14 | assets: 15 | - assets/images 16 | - assets/images/chip3/chip3.jpg 17 | - assets/images/chip3/chip3.jpg # duplicated 18 | - assets/images/chip4/ 19 | - assets/images/icons/fuchsia.svg 20 | - assets/images/icons/kmm.svg 21 | - assets/images/icons/paint.svg 22 | - assets/images/icons/dart@test.svg 23 | - assets/images/icons/invalid.svg 24 | - assets/json/ 25 | - pictures/chip5.jpg 26 | - assets/flare/ 27 | - assets/movie/ 28 | - assets/unknown/unknown_mime_type.bk 29 | - assets/images/animated 30 | -------------------------------------------------------------------------------- /examples/example_resources/lib/gen/colors.gen.dart: -------------------------------------------------------------------------------- 1 | // dart format width=80 2 | /// GENERATED CODE - DO NOT MODIFY BY HAND 3 | /// ***************************************************** 4 | /// FlutterGen 5 | /// ***************************************************** 6 | 7 | // coverage:ignore-file 8 | // ignore_for_file: type=lint 9 | // ignore_for_file: deprecated_member_use,directives_ordering,implicit_dynamic_list_literal,unnecessary_import 10 | 11 | import 'package:flutter/painting.dart'; 12 | import 'package:flutter/material.dart'; 13 | 14 | class ColorName { 15 | ColorName._(); 16 | 17 | /// Color: #000000 18 | static const Color black = Color(0xFF000000); 19 | 20 | /// Color: #979797 21 | static const Color gray410 = Color(0xFF979797); 22 | 23 | /// Color: #EEEEEE 24 | static const Color gray70 = Color(0xFFEEEEEE); 25 | 26 | /// Color: #FFFFFF 27 | static const Color white = Color(0xFFFFFFFF); 28 | } 29 | -------------------------------------------------------------------------------- /examples/example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 12.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /examples/example_resources/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: example_resources 2 | description: A sample project using FlutterGen. 3 | publish_to: 'none' 4 | 5 | environment: 6 | sdk: ^3.4.0 7 | 8 | dependencies: 9 | flutter: 10 | sdk: flutter 11 | 12 | flutter_svg: ^2.0.0 13 | lottie: ^3.0.0 14 | rive: ^0.13.20 15 | 16 | dev_dependencies: 17 | flutter_gen_runner: 18 | path: ../../packages/runner 19 | 20 | build_runner: ^2.0.0 21 | lints: any 22 | 23 | flutter_gen: 24 | output: lib/gen/ 25 | 26 | integrations: 27 | flutter_svg: true 28 | rive: true 29 | lottie: true 30 | 31 | assets: 32 | enabled: true 33 | outputs: 34 | package_parameter_enabled: true 35 | class_name: ResAssets 36 | 37 | fonts: 38 | enabled: true 39 | 40 | colors: 41 | enabled: true 42 | inputs: 43 | - assets/color/colors.xml 44 | 45 | flutter: 46 | assets: 47 | - assets/images/ 48 | - assets/unknown/unknown_mime_type.bk 49 | -------------------------------------------------------------------------------- /examples/example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.8.10' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:7.2.2' 10 | // START: FlutterFire Configuration 11 | classpath 'com.google.gms:google-services:4.3.15' 12 | classpath 'com.google.firebase:perf-plugin:1.4.2' 13 | // END: FlutterFire Configuration 14 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 15 | } 16 | } 17 | 18 | allprojects { 19 | repositories { 20 | google() 21 | mavenCentral() 22 | } 23 | } 24 | 25 | rootProject.buildDir = '../build' 26 | subprojects { 27 | project.buildDir = "${rootProject.buildDir}/${project.name}" 28 | } 29 | subprojects { 30 | project.evaluationDependsOn(':app') 31 | } 32 | 33 | tasks.register("clean", Delete) { 34 | delete rootProject.buildDir 35 | } 36 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /packages/command/flutter_gen.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /examples/example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /examples/example/web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "flutter_gen", 3 | "short_name": "flutter_gen", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A new Flutter project.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | }, 22 | { 23 | "src": "icons/Icon-maskable-192.png", 24 | "sizes": "192x192", 25 | "type": "image/png", 26 | "purpose": "maskable" 27 | }, 28 | { 29 | "src": "icons/Icon-maskable-512.png", 30 | "sizes": "512x512", 31 | "type": "image/png", 32 | "purpose": "maskable" 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /examples/example/android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /examples/example/.idea/libraries/Dart_SDK.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020-2022 FlutterGen 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/core/lib/utils/formatter.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io' as io show Platform; 2 | 3 | import 'package:dart_style/dart_style.dart' show DartFormatter; 4 | import 'package:pub_semver/pub_semver.dart' show VersionConstraint; 5 | 6 | import '../settings/config.dart' show Config; 7 | 8 | /// The formatter will only use the tall-style if the SDK constraint is ^3.7. 9 | DartFormatter buildDartFormatterFromConfig(Config config) { 10 | VersionConstraint? sdkConstraint = config.sdkConstraint; 11 | if (sdkConstraint == null) { 12 | final version = io.Platform.version.split(' ').first; 13 | sdkConstraint = VersionConstraint.parse('^$version'); 14 | } 15 | final useShort = sdkConstraint.allowsAny(VersionConstraint.parse('<3.7.0')); 16 | 17 | final pageWidth = 18 | config.pubspec.flutterGen.lineLength ?? config.formatterPageWidth; 19 | 20 | return DartFormatter( 21 | languageVersion: useShort 22 | ? DartFormatter.latestShortStyleLanguageVersion 23 | : DartFormatter.latestLanguageVersion, 24 | pageWidth: pageWidth, 25 | // trailingCommas: config.formatterTrailingCommas, 26 | lineEnding: '\n', 27 | ); 28 | } 29 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## What does this change? 2 | 3 | Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. 4 | 5 | Fixes # 🎯 6 | 7 | ## Type of change 8 | 9 | Please delete options that are not relevant. 10 | 11 | - [ ] Bug fix (non-breaking change which fixes an issue) 12 | - [ ] New feature (non-breaking change which adds functionality) 13 | - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) 14 | - [ ] This change requires a documentation update 15 | 16 | ## Checklist: 17 | 18 | Before submitting your PR, there are a few things you can do to make sure it goes smoothly: 19 | 20 | - [ ] Make sure to open a GitHub issue as a bug/feature request before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea 21 | - [ ] Ensure the tests (`melos run test`) 22 | - [ ] Ensure the analyzer and formatter pass (`melos run format` to automatically apply formatting) 23 | - [ ] Appropriate docs were updated (if necessary) 24 | -------------------------------------------------------------------------------- /examples/example/android/app/google-services.json: -------------------------------------------------------------------------------- 1 | { 2 | "project_info": { 3 | "project_number": "223276840801", 4 | "project_id": "flutter-gen-5b267", 5 | "storage_bucket": "flutter-gen-5b267.appspot.com" 6 | }, 7 | "client": [ 8 | { 9 | "client_info": { 10 | "mobilesdk_app_id": "1:223276840801:android:8c43b96e396a1781b77720", 11 | "android_client_info": { 12 | "package_name": "com.example.example" 13 | } 14 | }, 15 | "oauth_client": [ 16 | { 17 | "client_id": "223276840801-vd883eedtkum45svga4m9dqpppacohpi.apps.googleusercontent.com", 18 | "client_type": 3 19 | } 20 | ], 21 | "api_key": [ 22 | { 23 | "current_key": "AIzaSyBqCLgp5h6_dHlMJzKSsCfnSFawfFjCK1c" 24 | } 25 | ], 26 | "services": { 27 | "appinvite_service": { 28 | "other_platform_oauth_client": [ 29 | { 30 | "client_id": "223276840801-vd883eedtkum45svga4m9dqpppacohpi.apps.googleusercontent.com", 31 | "client_type": 3 32 | } 33 | ] 34 | } 35 | } 36 | } 37 | ], 38 | "configuration_version": "1" 39 | } 40 | -------------------------------------------------------------------------------- /packages/core/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_gen_core 2 | description: The Flutter code generator for your assets, fonts, colors, … — Get rid of all String-based APIs. 3 | version: 5.12.0 4 | homepage: https://github.com/FlutterGen/flutter_gen 5 | repository: https://github.com/FlutterGen/flutter_gen/tree/main/packages/core 6 | documentation: https://github.com/FlutterGen/flutter_gen 7 | issue_tracker: https://github.com/FlutterGen/flutter_gen/issues 8 | 9 | environment: 10 | sdk: ^3.4.0 11 | 12 | version_gen: 13 | path: lib/ 14 | 15 | dependencies: 16 | meta: ^1.7.0 17 | path: ^1.8.0 18 | yaml: ^3.0.0 19 | mime: '>=1.0.0 <3.0.0' 20 | xml: ^6.0.0 21 | dartx: ^1.0.0 22 | color: ^3.0.0 23 | collection: ^1.15.0 24 | json_annotation: ^4.4.0 25 | glob: ^2.0.0 26 | logging: ^1.3.0 27 | 28 | dart_style: ^3.0.0 29 | archive: '>=3.4.0 <5.0.0' 30 | args: ^2.0.0 31 | pub_semver: ^2.0.0 32 | vector_graphics_compiler: ^1.1.9 33 | image_size_getter: ^2.4.0 34 | image: ^4.5.4 35 | 36 | dev_dependencies: 37 | lints: any # Ignoring the version to allow editing across SDK versions. 38 | test: ^1.16.0 39 | build_runner: ^2.0.0 40 | json_serializable: ^6.0.0 41 | version_gen: ^1.0.1 42 | -------------------------------------------------------------------------------- /examples/example/macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | $(PRODUCT_COPYRIGHT) 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # See: https://dart-lang.github.io/linter/lints/ 2 | include: package:lints/recommended.yaml 3 | 4 | analyzer: 5 | exclude: 6 | - '**.g.dart' 7 | - 'test_resources/**' 8 | errors: 9 | deprecated_member_use_from_same_package: ignore 10 | unnecessary_import: error 11 | unawaited_futures: error 12 | 13 | formatter: 14 | trailing_commas: preserve 15 | 16 | linter: 17 | rules: 18 | # always_use_package_imports: true 19 | avoid_classes_with_only_static_members: true 20 | avoid_equals_and_hash_code_on_mutable_classes: true 21 | curly_braces_in_flow_control_structures: true 22 | directives_ordering: true 23 | flutter_style_todos: true 24 | prefer_const_constructors: true 25 | prefer_const_constructors_in_immutables: true 26 | prefer_final_in_for_each: true 27 | prefer_int_literals: true 28 | prefer_single_quotes: true 29 | require_trailing_commas: true 30 | sort_constructors_first: true 31 | sort_unnamed_constructors_first: true 32 | unawaited_futures: true 33 | unnecessary_await_in_return: true 34 | unnecessary_lambdas: true 35 | use_to_and_as_if_applicable: true 36 | use_raw_strings: true 37 | use_super_parameters: false 38 | -------------------------------------------------------------------------------- /packages/core/test_resources/pubspec_assets_deferred_components.yaml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | flutter_gen: 4 | output: lib/gen/ # Optional (default: lib/gen/) 5 | line_length: 80 # Optional (default: 80) 6 | 7 | integrations: 8 | flutter_svg: true 9 | 10 | flutter: 11 | assets: 12 | - assets/images 13 | - assets/images/chip3/chip3.jpg 14 | - assets/images/chip3/chip3.jpg # duplicated 15 | - assets/images/chip4/ 16 | - assets/images/icons/fuchsia.svg 17 | - assets/images/icons/kmm.svg 18 | - assets/images/icons/paint.svg 19 | - assets/images/icons/dart@test.svg 20 | - assets/json/ 21 | - pictures/chip5.jpg 22 | - assets/flare/ 23 | - assets/movie/ 24 | - assets/unknown/unknown_mime_type.bk 25 | - CHANGELOG.md 26 | 27 | deferred-components: 28 | - name: myDeferredComponent 29 | assets: 30 | - assets/deferred_component/images 31 | - assets/deferred_component/images/chip1.jpg 32 | - assets/deferred_component/images/component_logo.png 33 | # Deferred components can load assets from the main assets folder as well 34 | - assets/images/icons/fuchsia.svg 35 | - assets/images/2.0x/chip1.jpg 36 | 37 | - name: mySecondDeferredComponent 38 | assets: 39 | - assets/images/3.0x/chip1.jpg 40 | -------------------------------------------------------------------------------- /packages/core/test_resources/pubspec_normal.yaml: -------------------------------------------------------------------------------- 1 | name: example 2 | 3 | environment: 4 | sdk: ^3.8.0 5 | 6 | flutter_gen: 7 | output: lib/gen/ 8 | 9 | integrations: 10 | flutter_svg: true 11 | 12 | colors: 13 | inputs: 14 | - assets/color/colors.xml 15 | - assets/color/colors2.xml 16 | - assets/color/colors2.xml # duplicated 17 | 18 | flutter: 19 | uses-material-design: true 20 | assets: 21 | - assets/images/ 22 | - assets/images/chip3/chip3.jpg 23 | - assets/images/chip3/chip3.jpg # duplicated 24 | - assets/images/chip4/ 25 | - assets/images/icons/fuchsia.svg 26 | - assets/images/icons/kmm.svg 27 | - assets/images/icons/paint.svg 28 | - assets/images/icons/dart@test.svg 29 | - assets/json/ 30 | - pictures/chip5.jpg 31 | fonts: 32 | - family: Raleway 33 | fonts: 34 | - asset: assets/fonts/Raleway-Regular.ttf 35 | - asset: assets/fonts/Raleway-Italic.ttf 36 | style: italic 37 | - family: RobotoMono 38 | fonts: 39 | - asset: assets/fonts/RobotoMono-Regular.ttf 40 | - asset: assets/fonts/RobotoMono-Bold.ttf 41 | weight: 700 42 | 43 | # duplicated 44 | - family: RobotoMono 45 | fonts: 46 | - asset: assets/fonts/RobotoMono-Regular.ttf 47 | - asset: assets/fonts/RobotoMono-Bold.ttf 48 | weight: 700 49 | -------------------------------------------------------------------------------- /packages/core/lib/settings/config_default.dart: -------------------------------------------------------------------------------- 1 | const configDefaultYamlContent = ''' 2 | name: UNKNOWN 3 | 4 | flutter_gen: 5 | output: lib/gen/ # Optional 6 | # line_length: 80 # Optional 7 | parse_metadata: false # Optional 8 | 9 | # Optional 10 | integrations: 11 | image: true 12 | flutter_svg: false 13 | rive: false 14 | lottie: false 15 | 16 | images: 17 | # Optional 18 | parse_animation: false 19 | 20 | assets: 21 | enabled: true # Optional 22 | outputs: # Optional 23 | # Set to true if you want this package to be a package dependency 24 | # See: https://flutter.dev/docs/development/ui/assets-and-images#from-packages 25 | package_parameter_enabled: false # Optional 26 | # Available values: 27 | # - camel-case 28 | # - snake-case 29 | # - dot-delimiter 30 | style: dot-delimiter # Optional 31 | class_name: Assets 32 | exclude: [] 33 | 34 | fonts: 35 | enabled: true # Optional 36 | outputs: # Optional 37 | class_name: FontFamily 38 | 39 | colors: 40 | enabled: true # Optional 41 | inputs: [] # Optional 42 | outputs: # Optional 43 | class_name: ColorName 44 | 45 | flutter: 46 | # See: https://flutter.dev/docs/development/ui/assets-and-images#specifying-assets 47 | assets: [] 48 | # See: https://flutter.dev/docs/cookbook/design/fonts#2-declare-the-font-in-the-pubspec 49 | fonts: [] 50 | '''; 51 | -------------------------------------------------------------------------------- /packages/core/lib/utils/map.dart: -------------------------------------------------------------------------------- 1 | // Copy from https://pub.dev/packages/merge_map 2 | 3 | /// Exposes the [mergeMap] function, which... merges Maps. 4 | void _copyValues( 5 | Map from, 6 | Map to, 7 | bool recursive, 8 | bool acceptNull, 9 | ) { 10 | for (final key in from.keys) { 11 | if (from[key] is Map && recursive) { 12 | if (to[key] is! Map) { 13 | to[key] = {} as V; 14 | } 15 | _copyValues(from[key] as Map, to[key] as Map, recursive, acceptNull); 16 | } else { 17 | if (from[key] != null || acceptNull) { 18 | to[key] = from[key] as V; 19 | } 20 | } 21 | } 22 | } 23 | 24 | /// Merges the values of the given maps together. 25 | /// 26 | /// `recursive` is set to `true` by default. If set to `true`, 27 | /// then nested maps will also be merged. Otherwise, nested maps 28 | /// will overwrite others. 29 | /// 30 | /// `acceptNull` is set to `false` by default. If set to `false`, 31 | /// then if the value on a map is `null`, it will be ignored, and 32 | /// that `null` will not be copied. 33 | Map mergeMap( 34 | Iterable?> maps, { 35 | bool recursive = true, 36 | bool acceptNull = false, 37 | }) { 38 | final result = {}; 39 | // ignore: avoid_function_literals_in_foreach_calls 40 | maps.forEach((map) { 41 | if (map != null) _copyValues(map, result, recursive, acceptNull); 42 | }); 43 | return result; 44 | } 45 | -------------------------------------------------------------------------------- /packages/core/test/fonts_gen_test.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:flutter_gen_core/generators/fonts_generator.dart'; 4 | import 'package:flutter_gen_core/settings/config.dart'; 5 | import 'package:flutter_gen_core/utils/error.dart'; 6 | import 'package:flutter_gen_core/utils/formatter.dart'; 7 | import 'package:test/test.dart'; 8 | 9 | import 'gen_test_helper.dart'; 10 | 11 | void main() { 12 | group('Test Fonts generator', () { 13 | test('Fonts on pubspec.yaml', () async { 14 | const pubspec = 'test_resources/pubspec_fonts.yaml'; 15 | await expectedFontsGen(pubspec); 16 | }); 17 | 18 | test('Wrong fonts settings on pubspec.yaml', () async { 19 | final config = loadPubspecConfig( 20 | File('test_resources/pubspec_fonts_no_family.yaml'), 21 | ); 22 | final formatter = buildDartFormatterFromConfig(config); 23 | 24 | expect( 25 | () => generateFonts(FontsGenConfig.fromConfig(config), formatter), 26 | throwsA(isA()), 27 | ); 28 | }); 29 | 30 | test('Change the class name', () async { 31 | const pubspec = 'test_resources/pubspec_fonts_change_class_name.yaml'; 32 | await expectedFontsGen(pubspec); 33 | }); 34 | 35 | test('Package parameter enabled', () async { 36 | const pubspec = 'test_resources/pubspec_fonts_package_parameter.yaml'; 37 | await expectedFontsGen(pubspec); 38 | }); 39 | }); 40 | } 41 | -------------------------------------------------------------------------------- /examples/example/assets/images/icons/fuchsia.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /packages/core/test_resources/assets/images/icons/fuchsia.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /examples/example/macos/Podfile: -------------------------------------------------------------------------------- 1 | platform :osx, '10.11' 2 | 3 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 4 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 5 | 6 | project 'Runner', { 7 | 'Debug' => :debug, 8 | 'Profile' => :release, 9 | 'Release' => :release, 10 | } 11 | 12 | def flutter_root 13 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) 14 | unless File.exist?(generated_xcode_build_settings_path) 15 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" 16 | end 17 | 18 | File.foreach(generated_xcode_build_settings_path) do |line| 19 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 20 | return matches[1].strip if matches 21 | end 22 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" 23 | end 24 | 25 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 26 | 27 | flutter_macos_podfile_setup 28 | 29 | target 'Runner' do 30 | use_frameworks! 31 | use_modular_headers! 32 | 33 | flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) 34 | end 35 | 36 | post_install do |installer| 37 | installer.pods_project.targets.each do |target| 38 | flutter_additional_macos_build_settings(target) 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /examples/example/example.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /examples/example/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | platform :ios, '13.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def flutter_root 14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) 15 | unless File.exist?(generated_xcode_build_settings_path) 16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" 17 | end 18 | 19 | File.foreach(generated_xcode_build_settings_path) do |line| 20 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 21 | return matches[1].strip if matches 22 | end 23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" 24 | end 25 | 26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 27 | 28 | flutter_ios_podfile_setup 29 | 30 | target 'Runner' do 31 | use_frameworks! 32 | use_modular_headers! 33 | 34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 35 | end 36 | 37 | post_install do |installer| 38 | installer.pods_project.targets.each do |target| 39 | flutter_additional_ios_build_settings(target) 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /packages/core/scripts/generate_facts.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:dartx/dartx_io.dart'; 4 | import 'package:flutter_gen_core/flutter_generator.dart'; 5 | import 'package:path/path.dart' as p; 6 | 7 | late final Directory dir; 8 | 9 | void main() async { 10 | dir = File.fromUri(Platform.script).parent.parent.directory('test_resources'); 11 | final configFiles = dir.listSync().whereType().where( 12 | (e) => e.extension == '.yaml', 13 | ); 14 | for (final file in configFiles) { 15 | final File pubspecFile; 16 | final File? buildFile; 17 | final String namePrefix; 18 | if (file.name.startsWith('build_')) { 19 | pubspecFile = File(p.join(dir.path, 'pubspec_assets.yaml')); 20 | buildFile = file; 21 | namePrefix = 'build_'; 22 | } else { 23 | pubspecFile = file; 24 | buildFile = null; 25 | namePrefix = ''; 26 | } 27 | final name = file.nameWithoutExtension.removePrefix('pubspec_'); 28 | final generator = FlutterGenerator( 29 | pubspecFile, 30 | buildFile: buildFile, 31 | assetsName: '${namePrefix}assets_$name.gen.dart', 32 | colorsName: '${namePrefix}colors_$name.gen.dart', 33 | fontsName: '${namePrefix}fonts_$name.gen.dart', 34 | overrideOutputPath: p.join(dir.path, 'actual_data'), 35 | ); 36 | await generator.build().catchError((e, s) { 37 | stderr.writeln('[FAILED] ${file.name} - ${buildFile?.name ?? 'N/A'}'); 38 | stderr.writeln('$e'); 39 | stderr.writeln('$s'); 40 | }); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /packages/core/lib/utils/string.dart: -------------------------------------------------------------------------------- 1 | extension StringExt on String { 2 | String camelCase() { 3 | final words = _intoWords(this) 4 | .map( 5 | (w) => '${w.substring(0, 1).toUpperCase()}' 6 | '${w.substring(1).toLowerCase()}', 7 | ) 8 | .toList(); 9 | words[0] = words[0].toLowerCase(); 10 | return words.join(); 11 | } 12 | 13 | String snakeCase() { 14 | final words = _intoWords(this).map((w) => w.toLowerCase()).toList(); 15 | return words.join('_'); 16 | } 17 | } 18 | 19 | String camelCase(String s) => s.camelCase(); 20 | 21 | String snakeCase(String s) => s.snakeCase(); 22 | 23 | List _intoWords(String path) { 24 | const symbols = [' ', '.', '/', '_', r'\', '-', '@']; 25 | final upperAlphaRegex = RegExp(r'[A-Z]'); 26 | final lowerAlphaRegex = RegExp(r'[a-z]'); 27 | final buffer = StringBuffer(); 28 | final words = []; 29 | 30 | for (var i = 0; i < path.length; i++) { 31 | final char = String.fromCharCode(path.codeUnitAt(i)); 32 | final nextChar = i + 1 == path.length 33 | ? null 34 | : String.fromCharCode(path.codeUnitAt(i + 1)); 35 | 36 | if (symbols.contains(char)) { 37 | continue; 38 | } 39 | 40 | buffer.write(char); 41 | 42 | final isEndOfWord = nextChar == null || 43 | (upperAlphaRegex.hasMatch(nextChar) && 44 | path.contains(lowerAlphaRegex)) || 45 | symbols.contains(nextChar); 46 | 47 | if (isEndOfWord) { 48 | words.add(buffer.toString()); 49 | buffer.clear(); 50 | } 51 | } 52 | 53 | return words; 54 | } 55 | -------------------------------------------------------------------------------- /examples/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "app_icon_16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "app_icon_32.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "app_icon_32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "app_icon_64.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "app_icon_128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "app_icon_256.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "app_icon_256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "app_icon_512.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "app_icon_512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "app_icon_1024.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /examples/example/.idea/workspace.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.yml: -------------------------------------------------------------------------------- 1 | name: Feature Request 2 | description: File a feature request 3 | title: '[FR]: ' 4 | labels: ['enhancement'] 5 | body: 6 | - type: markdown 7 | attributes: 8 | value: | 9 | Thanks for taking the time to fill out this feature request! 10 | - type: checkboxes 11 | attributes: 12 | label: Is there an existing issue for this? 13 | description: Please search to see if an issue already exists for this feature request. 14 | options: 15 | - label: I have searched the existing issues 16 | required: true 17 | - type: textarea 18 | id: describe-problem 19 | attributes: 20 | label: Describe the problem 21 | description: Is your feature request related to a problem? Please describe. 22 | placeholder: I'm always frustrated when... 23 | validations: 24 | required: true 25 | - type: textarea 26 | id: solution 27 | attributes: 28 | label: Describe the solution 29 | description: Please describe the solution you'd like. A clear and concise description of what you want to happen. 30 | validations: 31 | required: true 32 | - type: textarea 33 | id: context 34 | attributes: 35 | label: Additional context 36 | description: Add any other context or screenshots about the feature request here. 37 | validations: 38 | required: false 39 | - type: checkboxes 40 | id: terms 41 | attributes: 42 | label: Code of Conduct 43 | description: By submitting this issue, you agree to follow our [Code of Conduct](../../CODE_OF_CONDUCT.md) 44 | options: 45 | - label: I agree to follow this project's Code of Conduct 46 | required: true 47 | -------------------------------------------------------------------------------- /examples/example/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /examples/example_resources/example_resources.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /examples/example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | example 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | CADisableMinimumFrameDurationOnPhone 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /examples/example_resources/assets/images/dart.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /examples/example/test/svg_integrations_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:example/gen/assets.gen.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_svg/flutter_svg.dart'; 4 | import 'package:flutter_test/flutter_test.dart'; 5 | 6 | class SvgIntegrationsTest extends StatelessWidget { 7 | const SvgIntegrationsTest({required this.theme}); 8 | 9 | final SvgTheme theme; 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | return DefaultSvgTheme( 14 | theme: theme, 15 | child: MyAssets.images.icons.dartTest.svg(), 16 | ); 17 | } 18 | } 19 | 20 | void main() { 21 | group('Test SvgTheme behavior', () { 22 | const testTheme = SvgTheme(currentColor: Colors.red); 23 | 24 | testWidgets( 25 | 'Passed theme should be null', 26 | (widgetTester) async { 27 | await widgetTester.pumpWidget( 28 | const SvgIntegrationsTest(theme: testTheme), 29 | ); 30 | 31 | var finder = find.byType(SvgPicture); 32 | expect(finder, findsOneWidget); 33 | 34 | var svgWidget = widgetTester.widget(finder); 35 | var loader = svgWidget.bytesLoader as SvgAssetLoader; 36 | 37 | expect(loader.theme, isNull); 38 | }, 39 | ); 40 | 41 | testWidgets( 42 | 'Taken theme of SvgAssetLoader equals with one passed to parent DefaultSvgTheme', 43 | (widgetTester) async { 44 | await widgetTester.pumpWidget( 45 | const SvgIntegrationsTest(theme: testTheme), 46 | ); 47 | 48 | var finder = find.byType(SvgPicture); 49 | expect(finder, findsOneWidget); 50 | 51 | var svgWidget = widgetTester.widget(finder); 52 | var loader = svgWidget.bytesLoader as SvgAssetLoader; 53 | 54 | var svgCacheKey = loader.cacheKey(widgetTester.element(finder)); 55 | 56 | expect(svgCacheKey.theme, testTheme); 57 | }, 58 | ); 59 | }); 60 | } 61 | -------------------------------------------------------------------------------- /packages/core/lib/generators/generator_helper.dart: -------------------------------------------------------------------------------- 1 | import 'package:collection/collection.dart'; 2 | import 'package:flutter_gen_core/settings/import.dart'; 3 | 4 | String get header { 5 | return '''/// GENERATED CODE - DO NOT MODIFY BY HAND 6 | /// ***************************************************** 7 | /// FlutterGen 8 | /// ***************************************************** 9 | 10 | '''; 11 | } 12 | 13 | const _ignoredRules = [ 14 | 'deprecated_member_use', 15 | 'directives_ordering', 16 | 'implicit_dynamic_list_literal', 17 | 'unnecessary_import', 18 | ]; 19 | 20 | String get ignore { 21 | return '''// coverage:ignore-file 22 | // ignore_for_file: type=lint 23 | // ignore_for_file: ${_ignoredRules.join(',')} 24 | 25 | '''; 26 | } 27 | 28 | String import(Import package) { 29 | return 'import \'${package.import}\'' 30 | '${package.alias != null ? ' as ${package.alias}' : ''};'; 31 | } 32 | 33 | String sBuildDeprecation( 34 | String deprecated, 35 | String oldLocation, 36 | String newLocation, 37 | String url, 38 | List migration, 39 | ) { 40 | final lines = [ 41 | '⚠️ Error', 42 | 'The $deprecated option has been moved from `$oldLocation` to `$newLocation`.', 43 | 'It should be changed in the `pubspec.yaml`.', 44 | url, 45 | '', 46 | '```yaml', 47 | 'flutter_gen:', 48 | ...migration, 49 | '```', 50 | ]; 51 | 52 | final longestLineLength = lines 53 | .map( 54 | (line) => line 55 | .split('\n') 56 | .sorted((a, b) => b.length.compareTo(b.length)) 57 | .first 58 | .length, 59 | ) 60 | .sorted((a, b) => b.compareTo(a)) 61 | .first; 62 | 63 | final buffer = StringBuffer(); 64 | buffer.writeln('┌${'─' * (longestLineLength + 2)}┐'); 65 | for (final line in lines) { 66 | buffer.writeln('| ${line.padRight(longestLineLength)} |'); 67 | } 68 | buffer.writeln('└${'─' * (longestLineLength + 2)}┘'); 69 | return buffer.toString(); 70 | } 71 | -------------------------------------------------------------------------------- /examples/example/web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | flutter_gen 33 | 34 | 35 | 39 | 40 | 41 | 42 | 43 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /packages/core/test_resources/actual_data/assets_assets_rive_integrations.gen.dart: -------------------------------------------------------------------------------- 1 | // dart format width=80 2 | 3 | /// GENERATED CODE - DO NOT MODIFY BY HAND 4 | /// ***************************************************** 5 | /// FlutterGen 6 | /// ***************************************************** 7 | 8 | // coverage:ignore-file 9 | // ignore_for_file: type=lint 10 | // ignore_for_file: deprecated_member_use,directives_ordering,implicit_dynamic_list_literal,unnecessary_import 11 | 12 | import 'package:flutter/widgets.dart'; 13 | import 'package:rive/rive.dart' as _rive; 14 | 15 | class $AssetsRiveGen { 16 | const $AssetsRiveGen(); 17 | 18 | /// File path: assets/rive/vehicles.riv 19 | RiveGenImage get vehicles => const RiveGenImage('assets/rive/vehicles.riv'); 20 | 21 | /// List of all assets 22 | List get values => [vehicles]; 23 | } 24 | 25 | class Assets { 26 | const Assets._(); 27 | 28 | static const $AssetsRiveGen rive = $AssetsRiveGen(); 29 | } 30 | 31 | class RiveGenImage { 32 | const RiveGenImage(this._assetName, {this.flavors = const {}}); 33 | 34 | final String _assetName; 35 | final Set flavors; 36 | 37 | _rive.RiveAnimation rive({ 38 | String? artboard, 39 | List animations = const [], 40 | List stateMachines = const [], 41 | BoxFit? fit, 42 | Alignment? alignment, 43 | Widget? placeHolder, 44 | bool antialiasing = true, 45 | bool useArtboardSize = false, 46 | List<_rive.RiveAnimationController> controllers = const [], 47 | _rive.OnInitCallback? onInit, 48 | }) { 49 | return _rive.RiveAnimation.asset( 50 | _assetName, 51 | artboard: artboard, 52 | animations: animations, 53 | stateMachines: stateMachines, 54 | fit: fit, 55 | alignment: alignment, 56 | placeHolder: placeHolder, 57 | antialiasing: antialiasing, 58 | useArtboardSize: useArtboardSize, 59 | controllers: controllers, 60 | onInit: onInit, 61 | ); 62 | } 63 | 64 | String get path => _assetName; 65 | 66 | String get keyName => _assetName; 67 | } 68 | -------------------------------------------------------------------------------- /examples/example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | // START: FlutterFire Configuration 26 | apply plugin: 'com.google.gms.google-services' 27 | apply plugin: 'com.google.firebase.firebase-perf' 28 | // END: FlutterFire Configuration 29 | apply plugin: 'kotlin-android' 30 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 31 | 32 | android { 33 | compileSdkVersion 33 34 | 35 | sourceSets { 36 | main.java.srcDirs += 'src/main/kotlin' 37 | } 38 | 39 | lintOptions { 40 | disable 'InvalidPackage' 41 | } 42 | 43 | defaultConfig { 44 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 45 | applicationId "com.example.example" 46 | minSdkVersion 22 47 | targetSdkVersion 33 48 | versionCode flutterVersionCode.toInteger() 49 | versionName flutterVersionName 50 | } 51 | 52 | buildTypes { 53 | release { 54 | // TODO: Add your own signing config for the release build. 55 | // Signing with the debug keys for now, so `flutter run --release` works. 56 | signingConfig signingConfigs.debug 57 | } 58 | } 59 | } 60 | 61 | flutter { 62 | source '../..' 63 | } 64 | -------------------------------------------------------------------------------- /packages/core/lib/generators/integrations/rive_integration.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_gen_core/generators/integrations/integration.dart'; 2 | 3 | class RiveIntegration extends Integration { 4 | RiveIntegration(String packageName) : super(packageName); 5 | 6 | String? get packageExpression => isPackage ? 'packages/$packageName/' : null; 7 | 8 | @override 9 | List get requiredImports => const [ 10 | Import('package:flutter/widgets.dart'), 11 | Import('package:rive/rive.dart', alias: '_rive'), 12 | ]; 13 | 14 | @override 15 | String get classOutput => _classDefinition; 16 | 17 | String get _classDefinition => '''class RiveGenImage { 18 | const RiveGenImage( 19 | this._assetName, { 20 | this.flavors = const {}, 21 | }); 22 | 23 | final String _assetName; 24 | final Set flavors; 25 | 26 | ${isPackage ? "\n static const String package = '$packageName';" : ''} 27 | 28 | _rive.RiveAnimation rive({ 29 | String? artboard, 30 | List animations = const [], 31 | List stateMachines = const [], 32 | BoxFit? fit, 33 | Alignment? alignment, 34 | Widget? placeHolder, 35 | bool antialiasing = true, 36 | bool useArtboardSize = false, 37 | List<_rive.RiveAnimationController> controllers = const [], 38 | _rive.OnInitCallback? onInit, 39 | }) { 40 | return _rive.RiveAnimation.asset( 41 | ${isPackage ? '\'$packageExpression\$_assetName\'' : '_assetName'}, 42 | artboard: artboard, 43 | animations: animations, 44 | stateMachines: stateMachines, 45 | fit: fit, 46 | alignment: alignment, 47 | placeHolder: placeHolder, 48 | antialiasing: antialiasing, 49 | useArtboardSize: useArtboardSize, 50 | controllers: controllers, 51 | onInit: onInit, 52 | ); 53 | } 54 | 55 | String get path => _assetName; 56 | 57 | String get keyName => ${isPackage ? '\'$packageExpression\$_assetName\'' : '_assetName'}; 58 | }'''; 59 | 60 | @override 61 | String get className => 'RiveGenImage'; 62 | 63 | @override 64 | bool isSupport(AssetType asset) => asset.extension == '.riv'; 65 | 66 | @override 67 | bool get isConstConstructor => true; 68 | } 69 | -------------------------------------------------------------------------------- /packages/core/test/colors_gen_test.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:flutter_gen_core/generators/colors_generator.dart'; 4 | import 'package:flutter_gen_core/settings/color_path.dart'; 5 | import 'package:flutter_gen_core/settings/config.dart'; 6 | import 'package:flutter_gen_core/utils/error.dart'; 7 | import 'package:flutter_gen_core/utils/formatter.dart'; 8 | import 'package:test/test.dart'; 9 | 10 | import 'gen_test_helper.dart'; 11 | 12 | void main() { 13 | group('Test Color generator', () { 14 | test('Colors on pubspec.yaml', () async { 15 | const pubspec = 'test_resources/pubspec_colors.yaml'; 16 | await expectedColorsGen(pubspec); 17 | }); 18 | 19 | test('Wrong colors settings on pubspec.yaml', () async { 20 | final pubspec = File('test_resources/pubspec_colors_no_inputs.yaml'); 21 | final config = loadPubspecConfig(pubspec); 22 | final formatter = buildDartFormatterFromConfig(config); 23 | 24 | expect( 25 | () => generateColors( 26 | pubspec, 27 | formatter, 28 | config.pubspec.flutterGen.colors, 29 | ), 30 | throwsA(isA()), 31 | ); 32 | }); 33 | 34 | test('Wrong colors settings on pubspec.yaml', () async { 35 | final pubspec = File('test_resources/pubspec_colors_no_inputs_list.yaml'); 36 | final config = loadPubspecConfig(pubspec); 37 | final formatter = buildDartFormatterFromConfig(config); 38 | 39 | expect( 40 | () { 41 | return generateColors( 42 | pubspec, 43 | formatter, 44 | config.pubspec.flutterGen.colors, 45 | ); 46 | }, 47 | throwsA(isA()), 48 | ); 49 | }); 50 | 51 | test('ColorPath Tests', () async { 52 | const colorPath = ColorPath('test_resources/assets/color/colors.xml'); 53 | expect(colorPath.mime, 'application/xml'); 54 | expect(colorPath.isXml, isTrue); 55 | 56 | const wrongColorPath = ColorPath('test_resources/assets/json/map.json'); 57 | expect(wrongColorPath.isXml, isFalse); 58 | }); 59 | 60 | test('Change the class name', () async { 61 | const pubspec = 'test_resources/pubspec_colors_change_class_name.yaml'; 62 | await expectedColorsGen(pubspec); 63 | }); 64 | }); 65 | } 66 | -------------------------------------------------------------------------------- /packages/command/bin/flutter_gen_command.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:args/args.dart'; 4 | import 'package:flutter_gen_core/flutter_generator.dart'; 5 | import 'package:flutter_gen_core/utils/cast.dart' show safeCast; 6 | import 'package:flutter_gen_core/utils/log.dart' show log; 7 | import 'package:flutter_gen_core/version.gen.dart' show packageVersion; 8 | import 'package:logging/logging.dart' show Level; 9 | 10 | void main(List args) async { 11 | log.onRecord.listen((record) { 12 | if (record.level >= Level.WARNING) { 13 | stderr.writeln('[FlutterGen] [${record.level.name}] ${record.message}'); 14 | } else { 15 | stdout.writeln('[FlutterGen] ${record.message}'); 16 | } 17 | }); 18 | 19 | final parser = ArgParser(); 20 | parser.addOption( 21 | 'config', 22 | abbr: 'c', 23 | help: 'Set the path of pubspec.yaml.', 24 | defaultsTo: 'pubspec.yaml', 25 | ); 26 | 27 | parser.addOption( 28 | 'build', 29 | abbr: 'b', 30 | help: 'Set the path of build.yaml.', 31 | ); 32 | 33 | parser.addFlag( 34 | 'help', 35 | abbr: 'h', 36 | help: 'Help about any command', 37 | defaultsTo: false, 38 | ); 39 | 40 | parser.addFlag( 41 | 'version', 42 | abbr: 'v', 43 | help: 'FlutterGen version', 44 | defaultsTo: false, 45 | ); 46 | 47 | ArgResults results; 48 | try { 49 | results = parser.parse(args); 50 | if (results.wasParsed('help')) { 51 | log.info('Usage of the `fluttergen` command:\n${parser.usage}'); 52 | return; 53 | } else if (results.wasParsed('version')) { 54 | log.info('v$packageVersion'); 55 | return; 56 | } 57 | } on FormatException catch (e) { 58 | throw '$e\n\n${parser.usage}'; 59 | } 60 | 61 | final pubspecPath = safeCast(results['config']); 62 | if (pubspecPath == null || pubspecPath.trim().isEmpty) { 63 | throw ArgumentError('Invalid value $pubspecPath', 'config'); 64 | } 65 | final pubspecFile = File(pubspecPath).absolute; 66 | 67 | final buildPath = safeCast(results['build'])?.trim(); 68 | if (buildPath?.isEmpty ?? false) { 69 | throw ArgumentError('Invalid value $buildPath', 'build'); 70 | } 71 | final buildFile = buildPath == null ? null : File(buildPath).absolute; 72 | 73 | await FlutterGenerator(pubspecFile, buildFile: buildFile).build(); 74 | } 75 | -------------------------------------------------------------------------------- /packages/core/lib/generators/fonts_generator.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: prefer_const_constructors 2 | 3 | import 'package:dart_style/dart_style.dart'; 4 | import 'package:dartx/dartx.dart'; 5 | import 'package:flutter_gen_core/generators/generator_helper.dart'; 6 | import 'package:flutter_gen_core/settings/config.dart'; 7 | import 'package:flutter_gen_core/settings/pubspec.dart'; 8 | import 'package:flutter_gen_core/utils/error.dart'; 9 | import 'package:flutter_gen_core/utils/string.dart'; 10 | 11 | class FontsGenConfig { 12 | FontsGenConfig._( 13 | this._packageName, 14 | this.flutterGen, 15 | this.fonts, 16 | ); 17 | 18 | factory FontsGenConfig.fromConfig(Config config) { 19 | return FontsGenConfig._( 20 | config.pubspec.packageName, 21 | config.pubspec.flutterGen, 22 | config.pubspec.flutter.fonts, 23 | ); 24 | } 25 | 26 | final String _packageName; 27 | final FlutterGen flutterGen; 28 | final List fonts; 29 | 30 | String get packageParameterLiteral => 31 | flutterGen.fonts.outputs.packageParameterEnabled ? _packageName : ''; 32 | } 33 | 34 | String generateFonts( 35 | FontsGenConfig config, 36 | DartFormatter formatter, 37 | ) { 38 | final fonts = config.fonts; 39 | final fontsConfig = config.flutterGen.fonts; 40 | if (fonts.isEmpty) { 41 | throw InvalidSettingsException( 42 | 'The value of "flutter/fonts:" is incorrect.', 43 | ); 44 | } 45 | 46 | final buffer = StringBuffer(); 47 | final className = fontsConfig.outputs.className; 48 | buffer.writeln('// dart format width=${formatter.pageWidth}'); 49 | buffer.writeln(header); 50 | buffer.writeln(ignore); 51 | buffer.writeln('class $className {'); 52 | buffer.writeln('$className._();'); 53 | buffer.writeln(); 54 | 55 | final isPackage = config.packageParameterLiteral.isNotEmpty; 56 | if (isPackage) { 57 | buffer.writeln("static const String package = '${config._packageName}';"); 58 | buffer.writeln(); 59 | } 60 | 61 | fonts.map((element) => element.family).distinct().sorted().forEach((family) { 62 | final keyName = isPackage ? 'packages/\$package/$family' : family; 63 | buffer.writeln("""/// Font family: $family 64 | static const String ${family.camelCase()} = '$keyName';"""); 65 | }); 66 | 67 | buffer.writeln('}'); 68 | return formatter.format(buffer.toString()); 69 | } 70 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | 3 | on: 4 | pull_request: 5 | types: [opened, synchronize] 6 | push: 7 | branches: 8 | - 'main' 9 | 10 | jobs: 11 | build: 12 | name: Run on ${{ matrix.os }} 13 | runs-on: ${{ matrix.os }} 14 | strategy: 15 | matrix: 16 | os: [ubuntu-latest, windows-latest, macos-latest] 17 | steps: 18 | - uses: actions/checkout@v4 19 | - uses: wasabeef/import-asdf-tool-versions-action@v1.0.3 20 | id: asdf 21 | - uses: subosito/flutter-action@v2 22 | with: 23 | flutter-version: ${{ steps.asdf.outputs.flutter }} 24 | channel: stable 25 | cache: true 26 | 27 | - name: Set environment for MacOS & Ubuntu 28 | if: startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu') 29 | run: echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH 30 | 31 | - name: Set environment for Windows 32 | if: startsWith(matrix.os, 'windows') 33 | run: echo "%LOCALAPPDATA%\Pub\Cache\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append 34 | 35 | - name: Get dependencies 36 | run: | 37 | dart pub global activate melos 38 | melos bootstrap 39 | 40 | - name: Generate test data and see if changes 41 | run: | 42 | melos gen:actual_data 43 | git --no-pager diff --exit-code packages/core/test_resources/actual_data 44 | 45 | - name: Run tests for Dart packages 46 | if: startsWith(matrix.os, 'ubuntu') 47 | run: melos test:dart --no-select 48 | 49 | - name: Run tests for Flutter packages 50 | if: startsWith(matrix.os, 'ubuntu') 51 | run: melos test:flutter --no-select 52 | 53 | - name: Run coverage 54 | if: startsWith(matrix.os, 'ubuntu') 55 | run: melos coverage 56 | 57 | - uses: codecov/codecov-action@v5 58 | with: 59 | token: ${{ secrets.CODECOV_TOKEN }} 60 | files: ./packages/core/coverage.lcov 61 | 62 | - name: Generate example then check formats and changes 63 | run: | 64 | melos run gen:examples:command --no-select 65 | melos run gen:examples:build_runner --no-select 66 | dart format --set-exit-if-changed examples 67 | git --no-pager diff --exit-code examples 68 | 69 | - name: Statically analyze the code 70 | run: melos analyze 71 | -------------------------------------------------------------------------------- /examples/example/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /packages/core/lib/generators/integrations/integration.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:flutter_gen_core/settings/asset_type.dart'; 4 | import 'package:flutter_gen_core/settings/import.dart'; 5 | 6 | export 'package:flutter_gen_core/settings/asset_type.dart'; 7 | export 'package:flutter_gen_core/settings/import.dart'; 8 | 9 | /// A base class for all integrations. An integration is a class that 10 | /// generates code for a specific asset type. 11 | abstract class Integration { 12 | Integration(this.packageName, {this.parseMetadata = false}); 13 | 14 | /// The package name for this asset. If empty, the asset is not in a package. 15 | final String packageName; 16 | late final bool isPackage = packageName.isNotEmpty; 17 | 18 | bool isEnabled = false; 19 | 20 | final bool parseMetadata; 21 | 22 | List get requiredImports; 23 | 24 | String get classOutput; 25 | 26 | String get className; 27 | 28 | /// Is this asset type supported by this integration? 29 | FutureOr isSupport(AssetType asset); 30 | 31 | bool get isConstConstructor; 32 | 33 | String classInstantiate(AssetType asset) { 34 | final buffer = StringBuffer(className); 35 | buffer.write('('); 36 | buffer.write('\'${asset.posixStylePath}\''); 37 | if (asset.flavors.isNotEmpty) { 38 | buffer.write(', flavors: {'); 39 | final flavors = asset.flavors.map((e) => '\'$e\'').join(', '); 40 | buffer.write(flavors); 41 | buffer.write('}'); 42 | buffer.write(','); // Better formatting. 43 | } 44 | buffer.write(')'); 45 | return buffer.toString(); 46 | } 47 | } 48 | 49 | /// The deprecation message for the package argument 50 | /// if the asset is a library asset. 51 | const String deprecationMessagePackage = 52 | "@Deprecated('Do not specify package for a generated library asset')"; 53 | 54 | /// Useful metadata about the parsed asset file when [parseMetadata] is true. 55 | /// Currently only contains the width and height, but could contain more in 56 | /// future. 57 | class ImageMetadata { 58 | const ImageMetadata({ 59 | required this.width, 60 | required this.height, 61 | this.animation, 62 | }); 63 | 64 | final double width; 65 | final double height; 66 | final ImageAnimation? animation; 67 | } 68 | 69 | /// Metadata about the parsed animation file when [parseAnimation] is true. 70 | class ImageAnimation { 71 | const ImageAnimation({ 72 | required this.frames, 73 | required this.duration, 74 | }); 75 | 76 | final int frames; 77 | final Duration duration; 78 | } 79 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to FlutterGen 2 | 3 | _See also: [Contributor Covenant Code of Conduct](https://github.com/FlutterGen/flutter_gen/blob/main/CODE_OF_CONDUCT.md)_ 4 | 5 | ## Things you will need 6 | 7 | - Linux, Mac OS X, or Windows. 8 | - Flutter and Dart (Stable channel) 9 | - [Melos](https://melos.invertase.dev/) 10 | - Git 11 | 12 | ## [Melos](https://melos.invertase.dev/getting-started) Installation 13 | 14 | Melos can be installed as a global package via pub.dev: 15 | 16 | ```sh 17 | $ dart pub global activate melos 18 | ``` 19 | 20 | Once installed & setup, Melos needs to be bootstrapped. Bootstrapping has 2 primary roles: 21 | 22 | - Installing all package dependencies (internally using pub get). 23 | - Locally linking any packages together. 24 | 25 | ```sh 26 | $ melos bootstrap 27 | ``` 28 | 29 | ## Running the FlutterGen 30 | 31 | #### Use as Dart command 32 | 33 | To run `pub get` to make sure its dependencies have been downloaded, and use `dart command`. 34 | 35 | ```sh 36 | $ dart packages/command/bin/flutter_gen_command.dart --config example/pubspec.yaml 37 | ``` 38 | 39 | Or melos 40 | 41 | ```sh 42 | $ melos gen:examples:command 43 | ``` 44 | 45 | #### Use as part of build_runner 46 | 47 | ```sh 48 | $ cd example 49 | $ flutter packages pub run build_runner build 50 | ``` 51 | 52 | Or melos 53 | 54 | ```sh 55 | $ melos gen:example:build_runner 56 | ``` 57 | 58 | ## Running the tests 59 | 60 | To run the unit tests: 61 | 62 | ``` 63 | $ melos test 64 | ``` 65 | 66 | ## Contributing code 67 | 68 | We gladly accept contributions via GitHub pull requests. 69 | 70 | Please peruse the 71 | [Flutter style guide](https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo) before 72 | working on anything non-trivial. These guidelines are intended to 73 | keep the code consistent and avoid common pitfalls. 74 | 75 | To send us a pull request: 76 | 77 | - `git pull-request` (if you are using [Hub](http://github.com/github/hub/)) or 78 | go to `https://github.com/FlutterGen/flutter_gen` and click the 79 | "Compare & pull request" button 80 | 81 | Please make sure all your checkins have detailed commit messages explaining the patch. 82 | 83 | The tests are run automatically on contributions using GitHub Actions. However, due to 84 | cost constraints, pull requests from non-committers may not run all the tests 85 | automatically. 86 | 87 | Once you've gotten an LGTM from a project maintainer and once your PR has received 88 | the green light from all our automated testing, wait for one the package maintainers 89 | to merge the pull request and `pub submit` any affected packages. 90 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.yml: -------------------------------------------------------------------------------- 1 | name: Bug Report 2 | description: File a bug report 3 | title: '[BUG]: ' 4 | labels: ['bug'] 5 | body: 6 | - type: markdown 7 | attributes: 8 | value: | 9 | Thanks for taking the time to fill out this bug report! 10 | - type: checkboxes 11 | attributes: 12 | label: Is there an existing issue for this? 13 | description: Please search to see if an issue already exists for the bug you encountered. 14 | options: 15 | - label: I have searched the existing issues 16 | required: true 17 | - type: input 18 | id: version 19 | attributes: 20 | label: Version 21 | description: What version of our software are you running? ($ fluttergen -v) 22 | placeholder: ex. 5.0.0 23 | validations: 24 | required: false 25 | - type: dropdown 26 | id: command-type 27 | attributes: 28 | label: Command type 29 | description: What type of our software are you running? 30 | options: 31 | - build_runner (Default) 32 | - Dart command 33 | - Homebrew 34 | validations: 35 | required: true 36 | - type: textarea 37 | id: what-happened 38 | attributes: 39 | label: What happened? 40 | description: Also tell us, what did you expect to happen? 41 | placeholder: Tell us what you see! 42 | value: 'A bug happened!' 43 | validations: 44 | required: true 45 | - type: textarea 46 | id: pubspec 47 | attributes: 48 | label: Relevant a pubspec.yaml. 49 | description: Please copy and pates your pubspec.yaml. 50 | placeholder: | 51 | name: app 52 | 53 | flutter_gen: 54 | output: lib/gen/ 55 | # line_length: 80 56 | 57 | integrations: 58 | flutter_svg: true 59 | 60 | assets: 61 | enabled: true 62 | outputs: 63 | class_name: MyAssets 64 | 65 | fonts: 66 | enabled: true 67 | outputs: 68 | class_name: MyFonts 69 | 70 | flutter: 71 | assets: 72 | - assets/images 73 | render: yaml 74 | - type: textarea 75 | id: logs 76 | attributes: 77 | label: Relevant log output 78 | description: Please copy and paste any relevant log output, if any. 79 | render: shell 80 | - type: checkboxes 81 | id: terms 82 | attributes: 83 | label: Code of Conduct 84 | description: By submitting this issue, you agree to follow our [Code of Conduct](../../CODE_OF_CONDUCT.md) 85 | options: 86 | - label: I agree to follow this project's Code of Conduct 87 | required: true 88 | -------------------------------------------------------------------------------- /examples/example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 8 | 12 | 20 | 24 | 28 | 33 | 37 | 38 | 39 | 40 | 41 | 42 | 44 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /examples/example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: example 2 | description: A sample project using FlutterGen. 3 | publish_to: 'none' 4 | 5 | environment: 6 | sdk: ^3.4.0 7 | 8 | dependencies: 9 | flutter: 10 | sdk: flutter 11 | 12 | example_resources: 13 | path: ../example_resources 14 | 15 | flutter_svg: ^2.0.0 16 | lottie: ^3.0.0 17 | rive: ^0.13.20 18 | 19 | dev_dependencies: 20 | lints: any 21 | flutter_test: 22 | sdk: flutter 23 | 24 | flutter_gen_runner: 25 | path: ../../packages/runner 26 | 27 | build_runner: ^2.0.0 28 | 29 | flutter_gen: 30 | output: lib/gen/ # Optional (default: lib/gen/) 31 | 32 | integrations: 33 | flutter_svg: true 34 | rive: true 35 | lottie: true 36 | 37 | assets: 38 | enabled: true 39 | 40 | outputs: 41 | class_name: MyAssets 42 | package_parameter_enabled: false 43 | # Assets.imagesChip 44 | # style: camel-case 45 | 46 | # Assets.images_chip 47 | # style: snake-case 48 | 49 | # Assets.images.chip (default style) 50 | style: dot-delimiter 51 | 52 | exclude: 53 | - assets-extern/* 54 | - pictures/chip5.jpg 55 | 56 | fonts: 57 | enabled: true 58 | outputs: 59 | class_name: MyFontFamily 60 | 61 | colors: 62 | enabled: true 63 | outputs: 64 | class_name: MyColorName 65 | inputs: 66 | - assets/color/colors.xml 67 | - assets/color/colors2.xml 68 | - assets/color/colors2.xml # duplicated 69 | 70 | flutter: 71 | uses-material-design: true 72 | assets: 73 | - README.md 74 | - assets/images/ 75 | - assets/images/chip3/chip3.jpg 76 | - assets/images/chip3/chip3.jpg # duplicated 77 | - assets/images/icons/fuchsia.svg 78 | - assets/images/icons/kmm.svg 79 | - assets/images/icons/paint.svg 80 | - assets/images/icons/dart@test.svg 81 | - assets/json/ 82 | - assets/flare/ 83 | - assets/rive/ 84 | - assets/lottie/ 85 | - assets/lottie/wrong/ 86 | - assets/movie/ 87 | - assets/unknown/ 88 | - assets/mix/ 89 | - assets-extern/ 90 | - pictures/chip5.jpg 91 | 92 | - path: assets/images/chip4/chip4.jpg 93 | flavors: 94 | - extern 95 | fonts: 96 | - family: Raleway 97 | fonts: 98 | - asset: assets/fonts/Raleway-Regular.ttf 99 | - asset: assets/fonts/Raleway-Italic.ttf 100 | style: italic 101 | - family: RobotoMono 102 | fonts: 103 | - asset: assets/fonts/RobotoMono-Regular.ttf 104 | - asset: assets/fonts/RobotoMono-Bold.ttf 105 | weight: 700 106 | 107 | # duplicated 108 | - family: RobotoMono 109 | fonts: 110 | - asset: assets/fonts/RobotoMono-Regular.ttf 111 | - asset: assets/fonts/RobotoMono-Bold.ttf 112 | weight: 700 113 | -------------------------------------------------------------------------------- /packages/core/test_resources/actual_data/colors_change_output_path.gen.dart: -------------------------------------------------------------------------------- 1 | // dart format width=80 2 | /// GENERATED CODE - DO NOT MODIFY BY HAND 3 | /// ***************************************************** 4 | /// FlutterGen 5 | /// ***************************************************** 6 | 7 | // coverage:ignore-file 8 | // ignore_for_file: type=lint 9 | // ignore_for_file: deprecated_member_use,directives_ordering,implicit_dynamic_list_literal,unnecessary_import 10 | 11 | import 'package:flutter/painting.dart'; 12 | import 'package:flutter/material.dart'; 13 | 14 | class ColorName { 15 | ColorName._(); 16 | 17 | /// Color: #000000 18 | static const Color black = Color(0xFF000000); 19 | 20 | /// MaterialColor: 21 | /// 50: #FFF9E5E5 22 | /// 100: #FFF1BFBF 23 | /// 200: #FFE79595 24 | /// 300: #FFDD6A6A 25 | /// 400: #FFD64A4A 26 | /// 500: #FFCF2A2A 27 | /// 600: #FFCA2525 28 | /// 700: #FFC31F1F 29 | /// 800: #FFBD1919 30 | /// 900: #FFB20F0F 31 | static const MaterialColor crimsonRed = 32 | MaterialColor(0xFFCF2A2A, { 33 | 50: Color(0xFFF9E5E5), 34 | 100: Color(0xFFF1BFBF), 35 | 200: Color(0xFFE79595), 36 | 300: Color(0xFFDD6A6A), 37 | 400: Color(0xFFD64A4A), 38 | 500: Color(0xFFCF2A2A), 39 | 600: Color(0xFFCA2525), 40 | 700: Color(0xFFC31F1F), 41 | 800: Color(0xFFBD1919), 42 | 900: Color(0xFFB20F0F), 43 | }); 44 | 45 | /// Color: #979797 46 | static const Color gray410 = Color(0xFF979797); 47 | 48 | /// Color: #EEEEEE 49 | static const Color gray70 = Color(0xFFEEEEEE); 50 | 51 | /// Color: #FFFFFF 52 | static const Color white = Color(0xFFFFFFFF); 53 | 54 | /// MaterialColor: 55 | /// 50: #FFFBF2E5 56 | /// 100: #FFF5DFBE 57 | /// 200: #FFEFCA93 58 | /// 300: #FFE9B568 59 | /// 400: #FFE4A547 60 | /// 500: #FFDF9527 61 | /// 600: #FFDB8D23 62 | /// 700: #FFD7821D 63 | /// 800: #FFD27817 64 | /// 900: #FFCA670E 65 | static const MaterialColor yellowOcher = 66 | MaterialColor(0xFFDF9527, { 67 | 50: Color(0xFFFBF2E5), 68 | 100: Color(0xFFF5DFBE), 69 | 200: Color(0xFFEFCA93), 70 | 300: Color(0xFFE9B568), 71 | 400: Color(0xFFE4A547), 72 | 500: Color(0xFFDF9527), 73 | 600: Color(0xFFDB8D23), 74 | 700: Color(0xFFD7821D), 75 | 800: Color(0xFFD27817), 76 | 900: Color(0xFFCA670E), 77 | }); 78 | 79 | /// MaterialAccentColor: 80 | /// 100: #FFFFE8E0 81 | /// 200: #FFFFBCA3 82 | /// 400: #FFFFA989 83 | /// 700: #FFFF9E7A 84 | static const MaterialAccentColor yellowOcherAccent = 85 | MaterialAccentColor(0xFFFFBCA3, { 86 | 100: Color(0xFFFFE8E0), 87 | 200: Color(0xFFFFBCA3), 88 | 400: Color(0xFFFFA989), 89 | 700: Color(0xFFFF9E7A), 90 | }); 91 | } 92 | -------------------------------------------------------------------------------- /packages/core/test_resources/actual_data/colors_wrong_output_path.gen.dart: -------------------------------------------------------------------------------- 1 | // dart format width=80 2 | /// GENERATED CODE - DO NOT MODIFY BY HAND 3 | /// ***************************************************** 4 | /// FlutterGen 5 | /// ***************************************************** 6 | 7 | // coverage:ignore-file 8 | // ignore_for_file: type=lint 9 | // ignore_for_file: deprecated_member_use,directives_ordering,implicit_dynamic_list_literal,unnecessary_import 10 | 11 | import 'package:flutter/painting.dart'; 12 | import 'package:flutter/material.dart'; 13 | 14 | class ColorName { 15 | ColorName._(); 16 | 17 | /// Color: #000000 18 | static const Color black = Color(0xFF000000); 19 | 20 | /// MaterialColor: 21 | /// 50: #FFF9E5E5 22 | /// 100: #FFF1BFBF 23 | /// 200: #FFE79595 24 | /// 300: #FFDD6A6A 25 | /// 400: #FFD64A4A 26 | /// 500: #FFCF2A2A 27 | /// 600: #FFCA2525 28 | /// 700: #FFC31F1F 29 | /// 800: #FFBD1919 30 | /// 900: #FFB20F0F 31 | static const MaterialColor crimsonRed = 32 | MaterialColor(0xFFCF2A2A, { 33 | 50: Color(0xFFF9E5E5), 34 | 100: Color(0xFFF1BFBF), 35 | 200: Color(0xFFE79595), 36 | 300: Color(0xFFDD6A6A), 37 | 400: Color(0xFFD64A4A), 38 | 500: Color(0xFFCF2A2A), 39 | 600: Color(0xFFCA2525), 40 | 700: Color(0xFFC31F1F), 41 | 800: Color(0xFFBD1919), 42 | 900: Color(0xFFB20F0F), 43 | }); 44 | 45 | /// Color: #979797 46 | static const Color gray410 = Color(0xFF979797); 47 | 48 | /// Color: #EEEEEE 49 | static const Color gray70 = Color(0xFFEEEEEE); 50 | 51 | /// Color: #FFFFFF 52 | static const Color white = Color(0xFFFFFFFF); 53 | 54 | /// MaterialColor: 55 | /// 50: #FFFBF2E5 56 | /// 100: #FFF5DFBE 57 | /// 200: #FFEFCA93 58 | /// 300: #FFE9B568 59 | /// 400: #FFE4A547 60 | /// 500: #FFDF9527 61 | /// 600: #FFDB8D23 62 | /// 700: #FFD7821D 63 | /// 800: #FFD27817 64 | /// 900: #FFCA670E 65 | static const MaterialColor yellowOcher = 66 | MaterialColor(0xFFDF9527, { 67 | 50: Color(0xFFFBF2E5), 68 | 100: Color(0xFFF5DFBE), 69 | 200: Color(0xFFEFCA93), 70 | 300: Color(0xFFE9B568), 71 | 400: Color(0xFFE4A547), 72 | 500: Color(0xFFDF9527), 73 | 600: Color(0xFFDB8D23), 74 | 700: Color(0xFFD7821D), 75 | 800: Color(0xFFD27817), 76 | 900: Color(0xFFCA670E), 77 | }); 78 | 79 | /// MaterialAccentColor: 80 | /// 100: #FFFFE8E0 81 | /// 200: #FFFFBCA3 82 | /// 400: #FFFFA989 83 | /// 700: #FFFF9E7A 84 | static const MaterialAccentColor yellowOcherAccent = 85 | MaterialAccentColor(0xFFFFBCA3, { 86 | 100: Color(0xFFFFE8E0), 87 | 200: Color(0xFFFFBCA3), 88 | 400: Color(0xFFFFA989), 89 | 700: Color(0xFFFF9E7A), 90 | }); 91 | } 92 | -------------------------------------------------------------------------------- /packages/core/test_resources/actual_data/colors_only_flutter_gen_value.gen.dart: -------------------------------------------------------------------------------- 1 | // dart format width=80 2 | /// GENERATED CODE - DO NOT MODIFY BY HAND 3 | /// ***************************************************** 4 | /// FlutterGen 5 | /// ***************************************************** 6 | 7 | // coverage:ignore-file 8 | // ignore_for_file: type=lint 9 | // ignore_for_file: deprecated_member_use,directives_ordering,implicit_dynamic_list_literal,unnecessary_import 10 | 11 | import 'package:flutter/painting.dart'; 12 | import 'package:flutter/material.dart'; 13 | 14 | class ColorName { 15 | ColorName._(); 16 | 17 | /// Color: #000000 18 | static const Color black = Color(0xFF000000); 19 | 20 | /// MaterialColor: 21 | /// 50: #FFF9E5E5 22 | /// 100: #FFF1BFBF 23 | /// 200: #FFE79595 24 | /// 300: #FFDD6A6A 25 | /// 400: #FFD64A4A 26 | /// 500: #FFCF2A2A 27 | /// 600: #FFCA2525 28 | /// 700: #FFC31F1F 29 | /// 800: #FFBD1919 30 | /// 900: #FFB20F0F 31 | static const MaterialColor crimsonRed = 32 | MaterialColor(0xFFCF2A2A, { 33 | 50: Color(0xFFF9E5E5), 34 | 100: Color(0xFFF1BFBF), 35 | 200: Color(0xFFE79595), 36 | 300: Color(0xFFDD6A6A), 37 | 400: Color(0xFFD64A4A), 38 | 500: Color(0xFFCF2A2A), 39 | 600: Color(0xFFCA2525), 40 | 700: Color(0xFFC31F1F), 41 | 800: Color(0xFFBD1919), 42 | 900: Color(0xFFB20F0F), 43 | }); 44 | 45 | /// Color: #979797 46 | static const Color gray410 = Color(0xFF979797); 47 | 48 | /// Color: #EEEEEE 49 | static const Color gray70 = Color(0xFFEEEEEE); 50 | 51 | /// Color: #FFFFFF 52 | static const Color white = Color(0xFFFFFFFF); 53 | 54 | /// MaterialColor: 55 | /// 50: #FFFBF2E5 56 | /// 100: #FFF5DFBE 57 | /// 200: #FFEFCA93 58 | /// 300: #FFE9B568 59 | /// 400: #FFE4A547 60 | /// 500: #FFDF9527 61 | /// 600: #FFDB8D23 62 | /// 700: #FFD7821D 63 | /// 800: #FFD27817 64 | /// 900: #FFCA670E 65 | static const MaterialColor yellowOcher = 66 | MaterialColor(0xFFDF9527, { 67 | 50: Color(0xFFFBF2E5), 68 | 100: Color(0xFFF5DFBE), 69 | 200: Color(0xFFEFCA93), 70 | 300: Color(0xFFE9B568), 71 | 400: Color(0xFFE4A547), 72 | 500: Color(0xFFDF9527), 73 | 600: Color(0xFFDB8D23), 74 | 700: Color(0xFFD7821D), 75 | 800: Color(0xFFD27817), 76 | 900: Color(0xFFCA670E), 77 | }); 78 | 79 | /// MaterialAccentColor: 80 | /// 100: #FFFFE8E0 81 | /// 200: #FFFFBCA3 82 | /// 400: #FFFFA989 83 | /// 700: #FFFF9E7A 84 | static const MaterialAccentColor yellowOcherAccent = 85 | MaterialAccentColor(0xFFFFBCA3, { 86 | 100: Color(0xFFFFE8E0), 87 | 200: Color(0xFFFFBCA3), 88 | 400: Color(0xFFFFA989), 89 | 700: Color(0xFFFF9E7A), 90 | }); 91 | } 92 | -------------------------------------------------------------------------------- /packages/core/test_resources/actual_data/colors_colors_change_class_name.gen.dart: -------------------------------------------------------------------------------- 1 | // dart format width=80 2 | /// GENERATED CODE - DO NOT MODIFY BY HAND 3 | /// ***************************************************** 4 | /// FlutterGen 5 | /// ***************************************************** 6 | 7 | // coverage:ignore-file 8 | // ignore_for_file: type=lint 9 | // ignore_for_file: deprecated_member_use,directives_ordering,implicit_dynamic_list_literal,unnecessary_import 10 | 11 | import 'package:flutter/painting.dart'; 12 | import 'package:flutter/material.dart'; 13 | 14 | class MyColorName { 15 | MyColorName._(); 16 | 17 | /// Color: #000000 18 | static const Color black = Color(0xFF000000); 19 | 20 | /// MaterialColor: 21 | /// 50: #FFF9E5E5 22 | /// 100: #FFF1BFBF 23 | /// 200: #FFE79595 24 | /// 300: #FFDD6A6A 25 | /// 400: #FFD64A4A 26 | /// 500: #FFCF2A2A 27 | /// 600: #FFCA2525 28 | /// 700: #FFC31F1F 29 | /// 800: #FFBD1919 30 | /// 900: #FFB20F0F 31 | static const MaterialColor crimsonRed = 32 | MaterialColor(0xFFCF2A2A, { 33 | 50: Color(0xFFF9E5E5), 34 | 100: Color(0xFFF1BFBF), 35 | 200: Color(0xFFE79595), 36 | 300: Color(0xFFDD6A6A), 37 | 400: Color(0xFFD64A4A), 38 | 500: Color(0xFFCF2A2A), 39 | 600: Color(0xFFCA2525), 40 | 700: Color(0xFFC31F1F), 41 | 800: Color(0xFFBD1919), 42 | 900: Color(0xFFB20F0F), 43 | }); 44 | 45 | /// Color: #979797 46 | static const Color gray410 = Color(0xFF979797); 47 | 48 | /// Color: #EEEEEE 49 | static const Color gray70 = Color(0xFFEEEEEE); 50 | 51 | /// Color: #FFFFFF 52 | static const Color white = Color(0xFFFFFFFF); 53 | 54 | /// MaterialColor: 55 | /// 50: #FFFBF2E5 56 | /// 100: #FFF5DFBE 57 | /// 200: #FFEFCA93 58 | /// 300: #FFE9B568 59 | /// 400: #FFE4A547 60 | /// 500: #FFDF9527 61 | /// 600: #FFDB8D23 62 | /// 700: #FFD7821D 63 | /// 800: #FFD27817 64 | /// 900: #FFCA670E 65 | static const MaterialColor yellowOcher = 66 | MaterialColor(0xFFDF9527, { 67 | 50: Color(0xFFFBF2E5), 68 | 100: Color(0xFFF5DFBE), 69 | 200: Color(0xFFEFCA93), 70 | 300: Color(0xFFE9B568), 71 | 400: Color(0xFFE4A547), 72 | 500: Color(0xFFDF9527), 73 | 600: Color(0xFFDB8D23), 74 | 700: Color(0xFFD7821D), 75 | 800: Color(0xFFD27817), 76 | 900: Color(0xFFCA670E), 77 | }); 78 | 79 | /// MaterialAccentColor: 80 | /// 100: #FFFFE8E0 81 | /// 200: #FFFFBCA3 82 | /// 400: #FFFFA989 83 | /// 700: #FFFF9E7A 84 | static const MaterialAccentColor yellowOcherAccent = 85 | MaterialAccentColor(0xFFFFBCA3, { 86 | 100: Color(0xFFFFE8E0), 87 | 200: Color(0xFFFFBCA3), 88 | 400: Color(0xFFFFA989), 89 | 700: Color(0xFFFF9E7A), 90 | }); 91 | } 92 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://www.dartlang.org/guides/libraries/private-files 2 | 3 | # Miscellaneous 4 | *.class 5 | *.log 6 | *.pyc 7 | *.swp 8 | .DS_Store 9 | .atom/ 10 | .buildlog/ 11 | .history 12 | .svn/ 13 | 14 | # IntelliJ related 15 | *.ipr 16 | *.iws 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | # Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. 25 | **/pubspec.lock 26 | **/pubspec_overrides.yaml 27 | **/doc/api/ 28 | .dart_tool/ 29 | .flutter-plugins 30 | .flutter-plugins-dependencies 31 | .packages 32 | .pub-cache/ 33 | .pub/ 34 | **/build/ 35 | generated_plugin_registrant.dart 36 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 37 | 38 | # Fastlane related 39 | android/fastlane/report.xml 40 | ios/fastlane/report.xml 41 | 42 | # Android related 43 | **/android/**/gradle-wrapper.jar 44 | **/android/.gradle 45 | **/android/captures/ 46 | **/android/gradlew 47 | **/android/gradlew.bat 48 | **/android/local.properties 49 | **/android/**/GeneratedPluginRegistrant.java 50 | **/android/**/gen 51 | 52 | # iOS/XCode related 53 | **/ios/**/*.mode1v3 54 | **/ios/**/*.mode2v3 55 | **/ios/**/*.moved-aside 56 | **/ios/**/*.pbxuser 57 | **/ios/**/*.perspectivev3 58 | **/ios/**/*sync/ 59 | **/ios/**/.sconsign.dblite 60 | **/ios/**/.tags* 61 | **/ios/**/.vagrant/ 62 | **/ios/**/DerivedData/ 63 | **/ios/**/Icon? 64 | **/ios/**/Pods/ 65 | **/ios/**/.symlinks/ 66 | **/ios/**/profile 67 | **/ios/**/xcuserdata 68 | **/ios/.generated/ 69 | **/ios/build/ 70 | **/ios/Flutter/.last_build_id 71 | **/ios/Flutter/App.framework 72 | **/ios/Flutter/Flutter.framework 73 | **/ios/Flutter/Generated.xcconfig 74 | **/ios/Flutter/app.flx 75 | **/ios/Flutter/app.zip 76 | **/ios/Flutter/flutter_assets/ 77 | **/ios/Flutter/flutter_export_environment.sh 78 | **/ios/Flutter/Flutter.podspec 79 | **/ios/ServiceDefinitions.json 80 | **/ios/Runner/GeneratedPluginRegistrant.* 81 | **/ios/Runner/GoogleService-Info.plist 82 | !**/ios/**/default.mode1v3 83 | !**/ios/**/default.mode2v3 84 | !**/ios/**/default.pbxuser 85 | !**/ios/**/default.perspectivev3 86 | 87 | # macOS related 88 | **/macos/**/Pods/ 89 | **/macos/**/.symlinks/ 90 | **/macos/build/ 91 | **/macos/Flutter/ephemeral/ 92 | **/macos/**/dgph 93 | **/macos/**/xcuserdata/ 94 | 95 | # Web related 96 | *.dart.js 97 | *.info.json # Produced by the --dump-info flag. 98 | *.js # When generated by dart2js. Don't specify *.js if your 99 | # project includes source files written in JavaScript. 100 | *.js_ 101 | *.js.deps 102 | *.js.map 103 | node_modules/ 104 | 105 | ## Generated code 106 | # **/*.g.dart 107 | # **/*.gen.dart 108 | 109 | ## Test coverage 110 | coverage/ 111 | coverage.lcov 112 | 113 | ## Test resources 114 | **/test_resources/lib 115 | -------------------------------------------------------------------------------- /examples/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | --------------------------------------------------------------------------------