model_generator 1.1.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 61

Model Generator #

This model generator can be used to generate JsonSerializable models

pub package

Example of the model_generator/config.yaml file

UserModel:
  path: webservice/user
  properties:
    id:
      type: int
    name:
      type: string
    salary:
      type: double
    something:
      type: dynamic
    isLoggedIn:
      type: bool
    roles:
      type: array
      items:
        type: string
    addresses:
      type: array
      items:
        type: Address

Address:
  path: webservice/user
  properties:
    street:
      type: string

Run:

flutter packages run model_generator

Changelog #

[1.1.0] - 2020-02-01 #

Added #

  • #11 option to ignore a field in the json serialization

[1.0.0] - 2020-01-21 #

Fixed #

  • #6 yield is not supported. (keywords are changed to yieldValue the jsonName will still be yield)
  • #7 fixed readme
  • #8 _ should be removed
  • Some extra bugs and a more standard form is used.

[0.4.2] - 2019-10-09 #

Fixed #

  • Fixed import for @required

[0.4.0] - 2019-10-09 #

Added #

  • Named params to the models

[0.3.0] - 2019-10-09 #

Added #

  • Nullable fields added

[0.2.1] - 2019-10-09 #

Fixed #

  • Crash when using keywords

[0.2.0] - 2019-10-09 #

Added #

  • Custom Path

[0.1.0] - 2019-10-09 #

Fixed #

  • Bugfixing for unknown types
  • DateTime supported
  • number supported

[0.0.1] - 2019-09-27 #

Added #

-Initial release

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:model_generator_example/app.dart';

Future<void> main() async {
  runApp(MyApp());
}

Use this package as a library

1. Depend on it

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


dependencies:
  model_generator: ^1.1.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

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

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

  • Dart: 2.7.1
  • pana: 0.13.6

Maintenance issues and suggestions

Make sure dartdoc successfully runs on your package's source files. (-10 points)

exitCode: 255 stdout: parsing /dart-sdk/lib/async/async.dart... parsing /dart-sdk/lib/collection/collection.dart... parsing /dart-sdk/lib/internal/internal.dart... parsing /dart-sdk/lib/convert/convert.dart... parsing /dart-sdk/lib/typed_data/typed_data.dart... parsing /dart-sdk/lib/core/core.dart... parsing /dart-sdk/lib/math/math.dart... parsing /dart-sdk/lib/developer/developer.dart... parsing /dart-sdk/lib/isolate/isolate.dart... parsing /dart-sdk/lib/ffi/ffi.dart... parsing /dart-sdk/lib/html/dart2js/html_dart2js.dart... parsing /dart-sdk/lib/html/html_common/html_common_dart2js.dart... parsing /dart-sdk/lib/web_gl/dart2js/web_gl_dart2js.dart... parsing /dart-sdk/lib/_internal/js_runtime/lib/native_typed_data.dart... parsing /dart-sdk/lib/_internal/js_runtime/lib/interceptors.dart... parsing /dart-sdk/lib/_internal/js_runtime/lib/shared/embedded_names.dart... parsing /dart-sdk/lib/_internal/js_runtime/lib/js_helper.dart... parsing /dart-sdk/lib/_internal/js_runtime/lib/foreign_helper.dart... parsing /dart-sdk/lib/_internal/js_runtime/lib/js_names.dart... parsing /dart-sdk/lib/_internal/js_runtime/lib/rti.dart... parsing /dart-sdk/lib/_internal/js_runtime/lib/shared/recipe_syntax.dart... parsing /dart-sdk/lib/js_util/dart2js/js_util_dart2js.dart... parsing /dart-sdk/lib/html/html_common/metadata.dart... parsing /dart-sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart... parsing /dart-sdk/lib/svg/dart2js/svg_dart2js.dart... parsing /dart-sdk/lib/web_audio/dart2js/web_audio_dart2js.dart... parsing /dart-sdk/lib/web_sql/dart2js/web_sql_dart2js.dart... parsing /dart-sdk/lib/_http/http.dart... parsing /dart-sdk/lib/io/io.dart... parsing /dart-sdk/lib/js/dart2js/js_dart2js.dart... parsing /dart-sdk/lib/js/_js.dart... parsing /dart-sdk/lib/mirrors/mirrors.dart... parsing /dart-sdk/lib/html/dartium/nativewrappers.dart... parsing /dart-sdk/lib/cli/cli.dart... parsing /dart-sdk/lib/wasm/wasm.dart... parsing /dart-sdk/lib/_internal/js_runtime/lib/js_primitives.dart... parsing /dart-sdk/lib/_internal/js_runtime/lib/shared/async_await_error_codes.dart... Initialized dartdoc with 37 libraries in 28.8 seconds documenting model_generator Validating docs... no issues found Documented 0 public libraries in 1.4 seconds stderr: Documenting model_generator... Unhandled exception: dartdoc could not find any libraries to document #0 Dartdoc.generateDocs (package:dartdoc/dartdoc.dart:196:7)

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
path ^1.6.4 1.6.4
recase ^3.0.0 3.0.0
yaml ^2.2.0 2.2.0
Transitive dependencies
charcode 1.1.3
collection 1.14.12
meta 1.1.8
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
Dev dependencies
test ^1.11.1