flutter_asset_generator 0.4.3

  • Readme
  • Changelog
  • Installing
  • 57

flutter_asset_generator #

Automatically generate the dart file for pubspec.yaml

The purpose of this library is to help flutter developers automatically generate asset corresponding dart files to help developers release their hands from this meaningless job, and the open source community has a lot of the same functionality.

This library is based on dartlang's build library.



screenshot #


Usage #

use source #

add dart,pub to $PATH environment.

git clone https://github.com/CaiJingLong/flutter_resource_generator.git
cd flutter_resource_generator
pub get
dart bin/resource_generator.dart $flutter_project

pub global #


pub global activate flutter_asset_generator


fgen or fgen -s $flutter_project

Support options #

Use $ fgen -h or $ fgen --help see usage document.

fgen -h
-w, --[no-]watch    Continue to monitor changes after execution of orders.
                    (defaults to on)

-o, --output        Your resource file path.
                    If it's a relative path, the relative flutter root directory
                    (defaults to "lib/const/resource.dart")

-s, --src           Flutter project root path
                    (defaults to ".")

-h, --[no-]help     Help usage

File name #

Space, '.' and '-' in the path are converted to _.

convert filed name example:

images/1.png => IMAGES_PNG
images/hello_world.jpg => IMAGES_HELLO_WORLD_JPG
images/hello-world.jpg => IMAGES_HELLO_WORLD_JPG

Errors will occur in the following situations


Because the two field names will be exactly the same.

Change log #


Fix typos in codes and template.


Update description.

Update dependencies version.



  • Recursive query to remove path


Add option for gen


use pub global

[0.1.2] watch pubspec

watch pubspec


update readme


first version

Use this package as an executable

1. Install it

You can install the package from the command line:

$ pub global activate flutter_asset_generator

2. Use it

The package has the following executables:

$ fgen

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  flutter_asset_generator: ^0.4.3

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:flutter_asset_generator/builder.dart';
import 'package:flutter_asset_generator/logger.dart';
import 'package:flutter_asset_generator/markdown_image_server.dart';
import 'package:flutter_asset_generator/template.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jan 27, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.4

Health suggestions

Fix lib/builder.dart. (-4.41 points)

Analysis of lib/builder.dart reported 9 hints, including:

line 39 col 23: Unnecessary new keyword.

line 52 col 27: Unnecessary new keyword.

line 59 col 28: Unnecessary new keyword.

line 92 col 26: Unnecessary new keyword.

line 118 col 29: Unnecessary new keyword.

Fix bin/resource_generator.dart. (-0.50 points)

Analysis of bin/resource_generator.dart reported 1 hint:

line 9 col 16: Unnecessary new keyword.

Maintenance suggestions

Maintain an example.

None of the files in the package's example/ directory matches known example patterns.

Common filename patterns include main.dart, example.dart, and flutter_asset_generator.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.51.0 <3.0.0
args ^1.5.2 1.5.2
path ^1.6.4 1.6.4
yaml ^2.1.16 2.2.0
Transitive dependencies
charcode 1.1.2
collection 1.14.12
meta 1.1.8
source_span 1.6.0
string_scanner 1.0.5
term_glyph 1.1.0