darbiw 1.0.0 copy "darbiw: ^1.0.0" to clipboard
darbiw: ^1.0.0 copied to clipboard

Dart binary encoder/decoder with code generation for classes

darbiw #

Dart binary encoder/decoder with code generation for classes

Getting started #

Tag your classes with the @binary annotation and add the fromBuffer factory constructor:

@binary
final class User {
  final String id;
  final int age;
  final bool enabled;
  final AccountType accountType;

  User({
    required this.id,
    required this.age,
    required this.enabled,
    required this.accountType,
  });

  factory User.fromBuffer(Uint8List buffer) => _UserFromBuffer(buffer);
}

Then run:

dart run build_runner build

and your binary methods will be generated.

1
likes
0
points
24
downloads

Publisher

unverified uploader

Weekly Downloads

Dart binary encoder/decoder with code generation for classes

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

analyzer, build, dart_style, meta, source_gen

More

Packages that depend on darbiw