serializer 0.3.0

  • Example
  • Installing
  • Versions
  • 25

Build Status Coverage Status Pub version


Serialize and Deserialize Dart Object with reflectable

Codecs supported:

  • Json


import 'package:serializer/serializer.dart';

class MyModel {
    String name;

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

main() {
    Serializer serializer = new Serializer.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);




  • type_info_key is now optional

Breaking changes:

  • no initSerializer function anymore, instead, you have to instanciate a serializer classe
    • Serializer serializer = new Serializer.Json();
  • toJson and fromJson replace by encode and decode
    • see doc for more infos


  • type_info_key is now parametrable
  • json output is now simpler


  • Basic JSON serialization and desarialization


// Copyright (c) 2016, the Serializer project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

library serializer.example;

import 'package:serializer/serializer.dart';

class ModelA {
  String name;
  num age;

  ModelA([, this.age]);

class ModelB extends JsonObject {
  String city, country;


class ModelC extends JsonObject {
  String name, password;

  int age;

  ModelC([, this.password, this.age]);

main() {
  ModelA a = new ModelA("toto", 15);
  ModelB b = new ModelB("Paris", "France");
  ModelC c = new ModelC("Alice", "ThereIsNone", 42);


  var sz = TypedJsonObject.serializer;

  ModelA A = sz.decode(sz.encode(a));

Use this package as a library

1. Depend on it

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

  serializer: ^0.3.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.

3. Import it

Now in your Dart code, you can use:

import 'package:serializer/serializer.dart';
Version Uploaded Documentation Archive
0.8.2 Jul 29, 2018 Go to the documentation of serializer 0.8.2 Download serializer 0.8.2 archive
0.8.1 Jul 18, 2018 Go to the documentation of serializer 0.8.1 Download serializer 0.8.1 archive
0.8.0 Jul 6, 2018 Go to the documentation of serializer 0.8.0 Download serializer 0.8.0 archive
0.7.1 Sep 12, 2017 Go to the documentation of serializer 0.7.1 Download serializer 0.7.1 archive
0.7.0 Aug 22, 2017 Go to the documentation of serializer 0.7.0 Download serializer 0.7.0 archive
0.6.2+1 Aug 14, 2017 Go to the documentation of serializer 0.6.2+1 Download serializer 0.6.2+1 archive
0.6.2 Aug 14, 2017 Go to the documentation of serializer 0.6.2 Download serializer 0.6.2 archive
0.6.1 May 5, 2017 Go to the documentation of serializer 0.6.1 Download serializer 0.6.1 archive
0.6.0 Mar 24, 2017 Go to the documentation of serializer 0.6.0 Download serializer 0.6.0 archive
0.5.1 Dec 13, 2016 Go to the documentation of serializer 0.5.1 Download serializer 0.5.1 archive

All 31 versions...

Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

This package version is not analyzed, because it is more than two years old. Check the latest stable version for its analysis.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Maintenance issues and suggestions

Running dartdoc failed. (-10 points)

Make sure dartdoc runs without any issues.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.0.0 <2.0.0