proto_bytes 0.9.6 copy "proto_bytes: ^0.9.6" to clipboard
proto_bytes: ^0.9.6 copied to clipboard

A Flutter library for binary protocol serialization and deserialization.

Flutter proto_bytes library #

pub

用于二进制通信协议序列化与反序列化的底层依赖库。库内容精简,不与任何网络功能关联,只提供数据对象序列化与反序列化功能。

对于 ProtoBytes 的详细介绍可以查看:protobytes

使用 #

使用 protobytes 创建的协议模板编译得到的 ExampleInfo 对象来举例:

  • ExampleInfo 的序列化
ExampleInfo info = ExampleInfo();
info.byteProp = 1;
info.shortProp = 2;
info.doubleProp = pi;
info.longstringProp = 'hello word';
info.intListProp.addAll([1, 2, 3, 4, 5]);

AttInfo attInfo = AttInfo();
attInfo.attId = 1;
info.attInfo1ListProp.add(attInfo);

attInfo = AttInfo();
attInfo.attId = 2;
info.attInfo1ListProp.add(attInfo);

List<int> bytes = ExampleInfo.toBytes(info);
  • ExampleInfo 的反序列化
List<int> bytes = ...;
ExampleInfo info = ExampleInfo.fromBytes(bytes);
0
likes
150
points
28
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter library for binary protocol serialization and deserialization.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, typed_data

More

Packages that depend on proto_bytes