serializer 0.7.1

  • Installing
  • Versions
  • 74

Build Status Coverage Status Pub version


No maintenance on this package anymore. Prefer to use jaguar_serializer

Documentation aren't aligned with last version.


Serialize and Deserialize Dart Object with reflectable or codegen

Codecs supported:

  • Json


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);




Breaking changes:

  • Remove reflectable version
  • Update 'source_gen' to 0.5.4+2


  • Fix int/double/num conversion


  • Update reflectable to 1.0.0

Breaking changes:

  • Split the serializer in 2 versions:
    • codegen
    • reflectable
  • Add @UseType annotation only for codegen
  • Same API, change import to switch mode


    import "package:serializer/serializer_codegen.dart";
    Serializer ser = new CodegenSerializer.json();


    import "package:serializer/serializer_reflectable.dart";
    Serializer ser = new ReflectableSerializer.json();


  • Add DateTime codecs for seconds and milliseconds since epoch.
  • Add dynamic type serialization.
  • Add SerializedWithTypeInfo annotation to set typeInfo at the object's root.
  • withTypeInfo flag into Serializer methods only sets typeInfo at the object's root.

Breaking changes:

  • Fix coding style for Serializer factories.


Breaking changes:

  • Add useTypeInfo boolean to Serializer constructor.
  • Replace optional parameters with named parameters into Serializer methods.
  • useTypeInfo flag into Serializer methods could overidde the global useTypeInfo from instance.


  • fix decode when content is already decode.


  • Add toPrimaryObject method
  • fix some error with null


  • Minor fix when some value are Null.
  • Don't serialize static and const field


  • Add DateTimeUtcCodec an UTC DateTime codec.
  • Add ObjectId a simple ObjectId codec (for Mongo BSON).

Breaking changes:

  • Move codecs/codec.dart to codecs.dart
  • In class Serialize, serializer getter is no more static.
  • Remove DateTimeCodec from Serializer.Json and Serializer.TypedJson factories


  • Support cyclical objects (@referenceable & @reference annotations)
  • Support SerializedName class inheritance


  • Support mixins


  • 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

1. Depend on it

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

  serializer: "^0.7.1"

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter packages get

Alternatively, your editor might support pub get or packages 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.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
0.5.0+1 Nov 1, 2016 Go to the documentation of serializer 0.5.0+1 Download serializer 0.5.0+1 archive
0.5.0 Nov 1, 2016 Go to the documentation of serializer 0.5.0 Download serializer 0.5.0 archive
0.4.3 Aug 28, 2016 Go to the documentation of serializer 0.4.3 Download serializer 0.4.3 archive

All 28 versions...


We analyzed this package on Mar 5, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.31.0
  • pana: 0.10.3


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


Detected platforms: Flutter, web, other

No platform restriction found in primary library package:serializer/serializer.dart.


  • Fix issues reported by dartanalyzer or dartfmt.

    dartanalyzer or dartfmt reported 6 errors 1 hint.

    Strong-mode analysis of lib/src/codecs/object_id.dart failed with the following error:

    line: 5 col: 8
    Target of URI doesn't exist: 'package:bson/bson.dart'.

    Run dartfmt to format lib/src/core/api.dart.

  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Maintain an example.

    Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use serializer.dart.


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