tape 0.0.4 tape: ^0.0.4 copied to clipboard
A serializer for Dart objects that is completely type-safe and future- and backwards-compatible.
// ignore_for_file: uri_has_not_been_generated, avoid_print
import 'package:meta/meta.dart';
import 'package:tape/tape.dart';
// import 'main.g.dart';
@tape
class User {
Fruit({@required this.color, @required this.blub, @required this.amount});
final String name;
final Fruit fruit;
}
void main() {
tape.register({
...tapers.forDartCore(),
0: taper.forUser(),
1: taper.forPet(),
});
final bytes = tape();
final someFruit = Fruit(color: 'red', blub: true, amount: 1);
final taped = tape.encode(someFruit);
print('Fruit taped to $taped.');
}