jaguar_serializer 0.5.1

  • Installing
  • Versions
  • 95

Build Status


Format agnostic Serializer library that can be used in server and client for JSON, mongodb, postgresql, etc

Getting Started


pub global activate jaguar_serializer_cli

Add it to your project

    jaguar_serializer: <last-version>

Simple serializer

Create a file for your model.

library example.user;

import 'package:jaguar_serializer/jaguar_serializer.dart';

part 'user.g.dart';

Create you model.

/// User model
class User {
  String name;
  int age;

Declare a Serializer for your model

class UserJsonSerializer extends Serializer<User> with _$UserJsonSerializer {
  User createModel() => new User();

Generate Serializer

Configuration file (Optional since 0.3.5)

Jaguar Serializer need a configuration file to know which files have possible Serializer.

On your root directory, declare the serializer.yaml file with the following informations.

- lib/model/user.dart

You can use serializer init command to generate it.

If no files are provided, jaguar_serializer will take all dart files under lib, bin, example and test folders.


No you can build you serializer running the command

serializer build


pub run jaguar_serializer:serializer build

This command will create 'user.g.dart' file with the generated Serializer inside.


You can trigger the rebuild each time you do a change in you file by using the watch command.

serializer watch

Use Serializer

A Serializer will convert an instance of object to a Map<String, dynamic>, that can be used to apply conversion to JSON, YAML ...

You can directly use the generated Serializer and apply the conversion.

import 'package:jaguar_serializer/jaguar_serializer.dart';
import 'model/user.dart';

void main() {
  UserSerializer userSerializer = new UserSerializer();
  User user = userSerializer.fromMap({
        'name': 'John',
        'age': 25

You can also use a JSON repository or implement one.

import 'package:jaguar_serializer/jaguar_serializer.dart';
import 'model/user.dart';

void main() {
  SerializerRepo serializer = new JsonRepo()..add(new UserSerializer());
  User user = serializer.deserialize("{'name':'John','age': 25}", type: User);



  • Removed deprecated processors field in GenSerializer use processor field in Property instead


  • support disable null check
  • deprecate GenSerializer.processor fields, FieldProcessor go into GenSerializer.fields inside Property
  • support for default value, String, int, double, bool, if a field is non nullable, jaguar will use the default value declared in you object constructor

Breaking Change EnDecode, DecodeOnly, EncodeOnly does not use optional parameter in constructor anymore,

example: EnDecode({this.alias, bool isNullable, FieldProcessor<T, dynamic> processor, T defaultsTo})


  • Better support of ddc


  • Added docs
  • Fixed README


Breaking Changes

  • Generator is now in a separate package
  • Angular style annotations, only one annotation
  fields: const {
    'field': const EncodeOnly('f')
  ignore: const [
  processors: const {
   'dates': const DateTimeProcessor(),
  serializers: const [


  • to, from, serialize, deserialize methods now handle null values correctly


  • serialize and deserialize methods now handle null values correctly


  • SerializerRepo handles when type is dynamic


  • Added from and to methods to SerializerRepo


  • SerializerRepo now serializes and de-serializes built-in types at the root like Map, List<List>, etc
  • added addAll method to SerializerRepo to add multiple serializers
  • Validation for RawData custom field processor


  • Add builtin RawData Processor
  • Optimize CustomFieldProcessor


  • Update build package to >=0.9.3 <0.10.0


  • serializers.yaml is now optional, Jaguar Serializer will take all dart files under lib, bin, example and test folders. Be careful on big project, watch can be slow or take a lot of resources.


  • Fixed ProvideSerializer for Map fields


  • Better failure messages when property is an Object or dynamic


  • Added "exclude by default" feature


  • Update build (>=0.7.0 <0.8.0)
  • serializer init command, generate serializer.yaml
  • fix overrided field in double inside the generated code



  • Repository system (Json, Yaml)
  • embeded type => see typeKey
  • Optional parameters for GenSerializer :
    • bool typeKey (default:true) if you want to include the type
    • String modelName value that will be include as a type.


First release.


  1. Serializer for dart builtin types
  2. Custom serializers for fields
  3. Nested Map and List serializers


  • Fixed renaming encode field bug


  • Null nested objects are not serialized properly

1. Depend on it

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

  jaguar_serializer: "^0.5.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:jaguar_serializer/jaguar_serializer.dart';
Version Uploaded Documentation Archive
0.5.1 Nov 3, 2017 Go to the documentation of jaguar_serializer 0.5.1 Download jaguar_serializer 0.5.1 archive
0.5.0 Oct 8, 2017 Go to the documentation of jaguar_serializer 0.5.0 Download jaguar_serializer 0.5.0 archive
0.4.2 Sep 12, 2017 Go to the documentation of jaguar_serializer 0.4.2 Download jaguar_serializer 0.4.2 archive
0.4.1 Aug 9, 2017 Go to the documentation of jaguar_serializer 0.4.1 Download jaguar_serializer 0.4.1 archive
0.4.0 Aug 9, 2017 Go to the documentation of jaguar_serializer 0.4.0 Download jaguar_serializer 0.4.0 archive
0.3.16 Jul 21, 2017 Go to the documentation of jaguar_serializer 0.3.16 Download jaguar_serializer 0.3.16 archive
0.3.15 Jul 21, 2017 Go to the documentation of jaguar_serializer 0.3.15 Download jaguar_serializer 0.3.15 archive
0.3.14 Jul 21, 2017 Go to the documentation of jaguar_serializer 0.3.14 Download jaguar_serializer 0.3.14 archive
0.3.13 Jul 17, 2017 Go to the documentation of jaguar_serializer 0.3.13 Download jaguar_serializer 0.3.13 archive
0.3.12 Jul 13, 2017 Go to the documentation of jaguar_serializer 0.3.12 Download jaguar_serializer 0.3.12 archive

All 39 versions...


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

  • Dart: 2.0.0-dev.49.0
  • pana: 0.10.6


Describes how popular the package is relative to other packages. [more]
91 / 100
Code health derived from static analysis. [more]
99 / 100
Reflects how tidy and up-to-date the package is. [more]
100 / 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:jaguar_serializer/jaguar_serializer.dart.


  • 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.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 3 hints.

    Strong-mode analysis of lib/src/json/json.dart gave the following hint:

    line: 19 col: 37
    'JSON' is deprecated and shouldn't be used.

    Strong-mode analysis of lib/src/serializer/custom_codec.dart gave the following hint:

    line: 3 col: 8
    Unused import: '../annotations/annotations.dart'.

  • Maintain an example.

    None of the files in your example/ directory matches a known example patterns. Common file name patterns include: main.dart, example.dart or you could also use jaguar_serializer.dart.

  • Use analysis_options.yaml.

    Rename old .analysis_options file to analysis_options.yaml.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.8.0 <2.0.0
intl >=0.15.0 <0.16.0 0.15.6
yaml >=2.1.10 <3.0.0 2.1.13
yamlicious ^0.0.5 0.0.5
Transitive dependencies
charcode 1.1.1
collection 1.14.9
meta 1.1.2
path 1.5.1
quiver_iterables 1.0.1
source_span 1.4.0
string_scanner 1.0.2
Dev dependencies