borsh_annotation 0.3.0 copy "borsh_annotation: ^0.3.0" to clipboard
borsh_annotation: ^0.3.0 copied to clipboard

outdated

Annotation used to make a Dart object borsh serializable.

Annotations for the borsh generator #

See borsh generator.

This package is still under development, as an example you can use it as follows


@Struct()
class SimpleStruct1 extends BorshStruct {
  const SimpleStruct1({
    required this.strValue,
    required this.int32Value,
    required this.fixedIntegersArray,
    required this.dynamicStringArray,
  });

  factory SimpleStruct1.fromBorsh(List<int> bytes) =>
      _SimpleStruct1FromBorsh(bytes);

  @override
  List<int> toBorsh() => _SimpleStruct1ToBorsh(this);

  @string
  final String strValue;

  @i32
  final int int32Value;

  @Array.fixed(Borsh.u8, length: 3)
  final List<int> fixedIntegersArray;

  @Array.dynamic(Borsh.string)
  final List<String> dynamicStringArray;
}

The generator will generate a .g.dart file that you must include in your file as a part.

1
likes
0
pub points
80%
popularity

Publisher

verified publishercryptoplease.com

Annotation used to make a Dart object borsh serializable.

Repository (GitHub)
View/report issues

License

unknown (license)

More

Packages that depend on borsh_annotation