json_to_dart 1.0.1

JSON to Dart #

Build Status

Given a JSON string, this library will generate all the necesary Dart classes to parse and generate JSON.

This library is designed to generate Flutter friendly model classes following the flutter's doc recommendation.

Caveats #

  • When an empty array is given, it will create a List
  • Equal structures are not detected yet (Equal classes are going to be created over and over).
  • Properties named with funky names (like "!breaks", "|breaks", etc) or keyword (like "this", "break", "class", etc) will produce syntax errors.

Use this package as a library

1. Depend on it

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


dependencies:
  json_to_dart: ^1.0.1

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:json_to_dart/json_to_dart.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
49
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
70
Learn more about scoring.

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

  • Dart: 2.5.1
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, other

Primary library: package:json_to_dart/json_to_dart.dart with components: io.

Health suggestions

Fix lib/helpers.dart. (-1 points)

Analysis of lib/helpers.dart reported 2 hints:

line 1 col 26: Use lowercase_with_underscores when specifying a library prefix.

line 180 col 19: Avoid using null in if null operators.

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

Analysis of lib/syntax.dart reported 1 hint:

line 46 col 11: Use isNotEmpty instead of length

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.

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 json_to_dart.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 <3.0.0
convert ^2.0.1 2.1.1
dart_style ^1.0.10 1.3.2
json_ast ^1.0.5 1.0.5
Transitive dependencies
analyzer 0.38.5 0.39.0
args 1.5.2
async 2.4.0
charcode 1.1.2
collection 1.14.12
crypto 2.1.3
csslib 0.16.1
front_end 0.1.27 0.1.28
glob 1.2.0
grapheme_splitter 1.0.0
html 0.14.0+3
js 0.6.1+1
kernel 0.3.27 0.3.28
meta 1.1.7
node_interop 1.0.3
node_io 1.0.1+2
package_config 1.1.0
pedantic 1.8.0+1
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
yaml 2.2.0
Dev dependencies
path ^1.5.1 1.6.4
test ^1.3.0