transit 0.8.3 copy "transit: ^0.8.3" to clipboard
transit: ^0.8.3 copied to clipboard

Dart 1 only

Transit for Dart

transit-dart #

Dart package that implements Transit format.

Before reading this you should be familiar with the Transit format (http://transit-format.org)

Usage #

Quick intro:

void main(){
    var tJson = new JsonTransitCodec();
    
    tJson.encode([1, true, "It is working", new TransitKeyword("x")]);
    tJson.decode('[1, true, "It is working", "~:x"]');
    
    tJson.encoder.register(new MyClassHandler());
    tJson.encode(new MyClass("Some_Data"));
    
    tJson.decoder.register("my_tag",(data) => new MyClass(data));
    tJson.decode('["~#my_tag","Some_Data"]');
}

class MyClass{
    var data;
    MyClass(this.data);
}

class MyClassHandler extends WriteHandler<MyClass>{
    String tag(MyClass obj) => "my_tag";
    rep(MyClass obj) => obj.data;
}

For more information check [latest API documentation] (http://www.dartdocs.org/documentation/transit/latest).

Type mapping #

Supported built-in Dart types are: Null, bool, int, double, String, List (as array), Map (as cmap), Set, Queue (as list), Uri.

Library also provides the rest of Transit standard types: TransitKeyword, TransitSymbol, TransitBytes, TransitLink, TransitUuid, TransitTaggedValue.

0
likes
10
points
21
downloads

Publisher

unverified uploader

Weekly Downloads

Transit for Dart

Repository (GitHub)
View/report issues

License

BSD-3-Clause (license)

Dependencies

crypto, msgpack

More

Packages that depend on transit