flutter_asset_generator 0.2.0

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • new53

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]
6
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
53
Learn more about scoring.

We analyzed this package on Aug 12, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.11.8

Platforms

Detected platforms: Flutter, web, other

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

Suggestions

The description is too short.

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Package is pre-v1 release.

While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction of the API.

Maintain an example.

Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use flutter_asset_generator.dart.

Fix lib/template.dart.

Analysis of lib/template.dart reported 1 hint:

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

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.7+3
build_config ^0.3.1+2 0.3.1+2
path ^1.6.2 1.6.2
yaml ^2.1.14 2.1.15
Transitive dependencies
analyzer 0.32.4
args 1.5.0
async 2.0.8
charcode 1.1.2
collection 1.14.11
convert 2.0.2
crypto 2.0.6
csslib 0.14.4+1
front_end 0.1.4
glob 1.1.7
html 0.13.3+2
json_annotation 1.1.0
kernel 0.3.4
logging 0.11.3+2
meta 1.1.6
package_config 1.0.5
plugin 0.2.0+3
pub_semver 1.4.2
pubspec_parse 0.1.2+2
source_span 1.4.1
string_scanner 1.0.3
typed_data 1.1.6
utf 0.9.0+5
watcher 0.9.7+10
Dev dependencies
build_runner ^0.10.0