serialize function

ByteData serialize(
  1. String input
)

Implementation

ByteData serialize(String input) {
  final inputBytes = utf8.encode(input);
  final prefix = encodeVarUint(inputBytes.length);
  return Uint8List.fromList(List.of(prefix.followedBy(inputBytes)))
      .buffer
      .asByteData();
}