cereal_generator 0.0.1 copy "cereal_generator: ^0.0.1" to clipboard
cereal_generator: ^0.0.1 copied to clipboard

outdated

A serializer library for dart with no-overhead code generation.

Cereal, a serialization library for Dart #

Cereal offers no-boilerplate JSON serialization for Dart objects. It does this with Dart's new extension methods & code generation.

Example #

import 'package:cereal/cereal.dart';

part 'my_file.g.dart';

@cereal
class Struct {
    final int foo;
    final String bar;

    Struct({this.foo, this.bar});
}

The code generator will generate a Struct.toJson, as well as a json.decodeStruct method on the json object in dart:convert.

import 'dart:convert';

void main() {
    json.encode(
        Struct(
            foo: 0, 
            bar: 'hello world',
        ).toJson());

    final struct = json.decodeStruct(
        '{"foo": 0, "bar": "hello world"}',
    );
}
0
likes
0
pub points
0%
popularity

Publisher

unverified uploader

A serializer library for dart with no-overhead code generation.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

analyzer, build, build_config, source_gen

More

Packages that depend on cereal_generator