serializer_generator 0.8.2

Dart native

Serialization to JSON using source_gen

Build Status Coverage Status Pub version


No maintenance on this package anymore. Prefer to use jaguar_serializer

Documentation aren't aligned with last version.

Serializer #

Serialize and Deserialize Dart Object with reflectable or codegen

Codecs supported: #

  • Json

Example #

import 'package:serializer/serializer_reflectable.dart';

class MyModel {
    String name;

    //constructor need to be without parameters or with optional or positional.

main() {
    Serializer serializer = new ReflectableSerializer.Json();
    MyModel model = new MyModel("John", 24);
    String json = serializer.encode(model);
    Map jsonMap = serializer.toMap(model);

    model = serializer.decode(json, MyModel);
    model = serializer.fromMap(jsonMap, MyModel);

Documentations #