otter_json_generator

Last updated:

0 purchases

otter_json_generator Image
otter_json_generator Images
Add to Cart

Description:

otter json generator

Otter JSON





JSON serialization with code generation.

Table of Contents #

Table of Contents
Why use it
How to
Link
Authors

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:
copied to clipboard

annotate

@JSON
class Person {
String firstName;
String lastName;
}
copied to clipboard

generate

flutter pub run build_runner build
copied to clipboard

register

Otter.module(GeneratedJsonModule());
copied to clipboard

toJson, fromJson

Map<String, dynamic> map = Otter.toJson(Person());
Person person = Otter.fromJson({});
copied to clipboard

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());
copied to clipboard
Link #
otter_json
otter_json_generator
Authors #

@hokamc

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.