r_flutter 0.1.0

R.Flutter #

Generate constants for resources which require using them as a String like fonts and assets.

Images #

Instead of writing:

Image(image: AssetImage("assets/path/to/image.png"))

you can write:

Image(image: Images.image)
Fonts #

Instead of writing:

TextStyle(
    fontFamily: "Roboto",
)

you can write:

TextStyle(
    fontFamily: Fonts.roboto,
)
Fonts #

Instead of writing:

await rootBundle.loadString("assets/path/to/data.json")

you can write:

await rootBundle.loadString(Assets.data)

Generate code #

flutter packages pub run r_flutter:generate

Optional Parameters: #

pubspec-file (pubspec.yaml) #

Specify the pubspec file of the project

ignore-assets #

Specify asset folder which should be ignored for generating constants. Seperated by ","

intl-file #

Specify intl arb file to generate bindings for.

output-file (lib/r.g.dart) #

Specify the output file.

Use this package as a library

1. Depend on it

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


dependencies:
  r_flutter: ^0.1.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.

Popularity:
Describes how popular the package is relative to other packages. [more]
17
Health:
Code health derived from static analysis. [more]
98
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
60
Overall:
Weighted score of the above. [more]
50
Learn more about scoring.

We analyzed this package on Aug 18, 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, web, other

No platform restriction found in libraries.

Health suggestions

Fix lib/src/generator/assets_generator.dart. (-1 points)

Analysis of lib/src/generator/assets_generator.dart reported 2 hints:

line 15 col 7: Use isEmpty instead of length

line 28 col 7: Use isEmpty instead of length

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

Analysis of bin/generate.dart reported 1 hint:

line 2 col 8: Unused import: 'dart:convert'.

Fix lib/src/generator/fonts_generator.dart. (-0.50 points)

Analysis of lib/src/generator/fonts_generator.dart reported 1 hint:

line 5 col 7: Use isEmpty instead of length

Fix lib/src/parser/assets_parser.dart. (-0.50 points)

Analysis of lib/src/parser/assets_parser.dart reported 1 hint:

line 100 col 11: The value of the local variable 'first' isn't used.

Format lib/src/arguments.dart.

Run dartfmt to format lib/src/arguments.dart.

Maintenance issues and suggestions

Provide a file named CHANGELOG.md. (-20 points)

Changelog entries help developers follow the progress of your package. See the example generated by stagehand.

Support latest dependencies. (-20 points)

The version constraint in pubspec.yaml does not support the latest published versions for 2 dependencies (analyzer, dart_style).

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.33.0 <3.0.0
analyzer >=0.33.0-alpha.0 <0.34.0 0.33.6+1 0.38.0
args >=0.12.1 <2.0.0 1.5.2
dart_style ^1.0.0 1.2.0 1.2.9
path >=0.9.0 <2.0.0 1.6.4
recase ^2.0.1 2.0.1
yaml ^2.1.15 2.1.16
Transitive dependencies
async 2.3.0
charcode 1.1.2
collection 1.14.12
convert 2.1.1
crypto 2.1.1+1
csslib 0.16.1
front_end 0.1.6+9 0.1.22
glob 1.1.7
html 0.14.0+2
kernel 0.3.6+9 0.3.22
logging 0.11.3+2
meta 1.1.7
package_config 1.1.0
pedantic 1.8.0+1
plugin 0.2.0+3
pub_semver 1.4.2
source_span 1.5.5
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
watcher 0.9.7+12
Dev dependencies
test ^1.2.0