otter_json_generator 1.0.1 copy "otter_json_generator: ^1.0.1" to clipboard
otter_json_generator: ^1.0.1 copied to clipboard

outdated

JSON serialization with code generation. Separate generated code from source and keep everything clean.

Otter JSON

Otter JSON

Maintenance Status

JSON serialization with code generation.

Table of Contents #

Why use it? #

Do you suffer from json_serializable? All generated code and 'part' make your source code messy. With Otter JSON, keep everything simple and clean.

Features #

  • Generated code and source code are separated
  • Easy to register new serializer
  • Support all primitives
  • Support flutter common class
  • Support List
  • Support nested object

How to? #

  • dependencies
dependencies:
  otter_json:

dev_dependencies:
  build_runner:
  otter_json_generator:
  • annotate
@JSON
class Person {
  String firstName;
  String lastName;
}
  • generate
flutter pub run build_runner build
  • register
Otter.module(GeneratedJsonModule());
  • toJson, fromJson
Map<String, dynamic> map = Otter.toJson(Person());
Person person = Otter.fromJson({});
  • custom serializer
class ColorSerializer implements JsonSerializer<Color, int> {
  @override
  Color decode(int output) {
    return Color(output);
  }

  @override
  int encode(Color input) {
    return input.value;
  }
}

Otter.serializer(ColorSerializer());

otter_json

otter_json_generator

Authors #

0
likes
0
pub points
0%
popularity

Publisher

unverified uploader

JSON serialization with code generation. Separate generated code from source and keep everything clean.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

analyzer, build, build_runner, flutter, glob, otter_json, source_gen

More

Packages that depend on otter_json_generator