string_res 1.2.0

  • Readme
  • Changelog
  • Installing
  • 45

A Dart Builder for creating a class with String constants from a JSON file.

Usage #

JSON file MUST be named strings.json and live somewhere within the assets top-level folder of your Flutter app project.

The JSON file is expected to have a single top-level object whose properties will be used in the output.

The output will create a Class named SR in lib/strings.dart which will contain a static String constant for every property found in the top-level JSON object.

For Flutter run using standard command: flutter packages pub run build_runner build

or with the new hot-reload code-gen builder support

Features and bugs #

Please file feature requests and bugs at the issue tracker.

1.2.0 #

  • Move to using source JSON in assets folder as strings.json and output to lib/strings.dart

1.1.1 #

  • Fix bug with handling josn value with newline characters.

1.1.0 #

  • Add comments for each String const with value of the JSON property

1.0.0 #

  • Initial version, created by Stagehand

Use this package as a library

1. Depend on it

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

  string_res: ^1.2.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:string_res/string_res.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 Feb 27, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.5

Maintenance suggestions

The package description is too short. (-18 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 string_res.dart. Packages with multiple examples should provide example/

For more information see the pub package layout conventions.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.5.0 <3.0.0
build ^1.1.4 1.2.2
build_config ^0.4.0 0.4.2
dart_style ^1.2.8 1.3.3
glob ^1.2.0 1.2.0
meta ^1.1.6 1.1.8
path ^1.6.4 1.6.4
Transitive dependencies
_fe_analyzer_shared 1.0.3
analyzer 0.39.4
args 1.5.2
async 2.4.0
charcode 1.1.3
checked_yaml 1.0.2
collection 1.14.12
convert 2.1.1
crypto 2.1.4
csslib 0.16.1
html 0.14.0+3
js 0.6.1+1
json_annotation 3.0.1
logging 0.11.4
node_interop 1.0.3
node_io 1.0.1+2
package_config 1.9.1
pub_semver 1.4.3
pubspec_parse 0.1.5
source_span 1.6.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
watcher 0.9.7+13
yaml 2.2.0
Dev dependencies
pedantic ^1.9.0 1.9.0
test any