serializer 0.4.1+1 copy "serializer: ^0.4.1+1" to clipboard
serializer: ^0.4.1+1 copied to clipboard

outdatedDart 1 only

Serialization to JSON using reflectable

Build Status Coverage Status Pub version

Serializer #

Serialize and Deserialize Dart Object with reflectable

Codecs supported: #

  • Json

Example #

import 'package:serializer/serializer.dart';

@serializable
class MyModel {
    String name;

    //constructor need to be without parameters or with optional or positional.
    MyModel([this.name]);
}

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

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

Documentations #

1
likes
0
pub points
14%
popularity

Publisher

unverified uploader

Serialization to JSON using reflectable

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

bson, reflectable

More

Packages that depend on serializer