请帮忙提供一个在 dart 中对 protobuf 进行编码的简单示例

cha*_*n95 4 protocol-buffers dart

谁能帮忙提供一个简单的例子来在 dart 中为 protobuf 编码数据...

完全理解如何在浏览器中解码从服务器接收到的 protobuf 数据......

MyMessage.fromBuffer(binaryDataList);
Run Code Online (Sandbox Code Playgroud)

不知道如何在浏览器中将数据编码为 protobuf 以发送回服务器。

Fox*_*x32 5

您可以writeToBuffer()在消息中使用来获取可通过 AJAX 或 Websockets 发送的字节列表。返回的缓冲区的类型Uint8List实现了List<int>.