flutter_asset_generator 0.2.0

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 53

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

install #

pubspec.yaml

dev_dependencies:
  build_runner: ^0.9.0
  flutter_asset_generator: ^0.1.2

use #

cli run: flutter packages pub run build_runner build

cli watch and auto generate: flutter packages pub run build_runner watch

The command will block, the resource.dart will change when your images change or pubspec.yaml is edited.

you can use ctrl+c/cmd+c to exit the program.

0.2.0 changelog

Like other build libraries, build/watch commands can now be used normally.

But,user must add a build.yaml into your project root path. Bacause build library default only watch https://www.dartlang.org/tools/pub/package-layout's list. The list have not 'images' path.

build.yaml content is :

targets:
  $default:
    sources:
      - images/**
      - pubspec.*

the images/** is your image path

and your also download the file from github.

build.yaml

other #

The library will put your every file in the asset path into resource.dart,not just picture files.

However, changes can only be triggered when the files of the following extension are changed.

".png"
".jpg"
".jpeg"
".gif"
".webp"
".bmp"
".wbmp"
".yaml"
".lock"

convert filed name example:

images/1.png => IMAGES_PNG
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.

tips #

If you run the 'flutter packages run build_runner watch' in cli ,then you change the pubspec.yaml, you must stop the watch, becasue flutter's locked.

Change log #

[0.1.2] watch pubspec

watch pubspec

[0.1.1]

update readme

[0.1.0]

first version

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_asset_generator: ^0.2.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages 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/main.dart';
import 'package:flutter_asset_generator/template.dart';
  
Version Uploaded Documentation Archive
0.2.0 Aug 12, 2018 Go to the documentation of flutter_asset_generator 0.2.0 Download flutter_asset_generator 0.2.0 archive
0.1.2 Aug 6, 2018 Go to the documentation of flutter_asset_generator 0.1.2 Download flutter_asset_generator 0.1.2 archive
0.1.1 Aug 6, 2018 Go to the documentation of flutter_asset_generator 0.1.1 Download flutter_asset_generator 0.1.1 archive
0.1.0 Aug 6, 2018 Go to the documentation of flutter_asset_generator 0.1.0 Download flutter_asset_generator 0.1.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
18
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
70
Overall:
Weighted score of the above. [more]
53
Learn more about scoring.

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

  • Dart: 2.2.0
  • pana: 0.12.14

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:flutter_asset_generator/main.dart.

Health suggestions

Fix lib/template.dart. (-0.50 points)

Analysis of lib/template.dart reported 1 hint:

line 41 col 10: The method '_formatDotPartName' isn't used.

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. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

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
build ^0.12.7+3 0.12.8 1.1.3
build_config ^0.3.1+2 0.3.2
path ^1.6.2 1.6.2
yaml ^2.1.14 2.1.15
Transitive dependencies
analyzer 0.32.6 0.36.0
args 1.5.1
async 2.2.0
charcode 1.1.2
collection 1.14.11
convert 2.1.1
crypto 2.0.6
csslib 0.15.0
front_end 0.1.4+2 0.1.15
glob 1.1.7
html 0.14.0+1
json_annotation 2.2.0
kernel 0.3.4+2 0.3.15
logging 0.11.3+2
meta 1.1.7
package_config 1.0.5
plugin 0.2.0+3
pub_semver 1.4.2
pubspec_parse 0.1.4
source_span 1.5.5
string_scanner 1.0.4
term_glyph 1.1.0
typed_data 1.1.6
watcher 0.9.7+10
Dev dependencies
build_runner ^0.10.0