flutter_asset_generator 0.4.0

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.

中文文档

English

screenshot #

img

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 #

install:

pub global activate flutter_asset_generator

use:

fgen $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

  images/
    main_login.png
    main/
      login.png

Because the two field names will be exactly the same.

Change log #

[0.4.0]

Add option for gen

[0.3.0]

use pub global

[0.1.2] watch pubspec

watch pubspec

[0.1.1]

update readme

[0.1.0]

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:


dependencies:
  flutter_asset_generator: ^0.4.0

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/const/resource.dart';
import 'package:flutter_asset_generator/markdown_image_server.dart';
import 'package:flutter_asset_generator/template.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
12
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
52
Learn more about scoring.

We analyzed this package on Jul 17, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19

Platforms

Detected platforms: Flutter, other

Platform components identified in package: io.

Health suggestions

Format lib/const/resource.dart.

Run dartfmt to format lib/const/resource.dart.

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

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.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.51.0 <3.0.0
args ^1.5.1 1.5.2
path ^1.6.2 1.6.2
yaml ^2.1.15 2.1.16
Transitive dependencies
charcode 1.1.2
collection 1.14.11
meta 1.1.7
source_span 1.5.5
string_scanner 1.0.4
term_glyph 1.1.0

Admin