chameleon95
chameleon95

Reputation: 244

Please help provide a simple example to encode for protobuf in dart

Can anyone please help provide a simple example to encode data for protobuf in dart...

Fully understand how to decode the protobuf data received from a server in the browser...

MyMessage.fromBuffer(binaryDataList);

Not sure how to encode the data to protobuf in the browser to send back to the server..

Upvotes: 4

Views: 1177

Answers (1)

Fox32
Fox32

Reputation: 13560

You can use writeToBuffer() on your message to get a list of bytes that you can send via AJAX or Websockets. The returned buffer is of the type Uint8List that implements List<int>.

Upvotes: 5

Related Questions