toByteArray static method

Future<List<int>> toByteArray(
  1. Serializer obj
)

Convenience class to serialize to a bytearray. @param obj the object to serialize @return byteArray representing the object

Implementation

static Future<List<int>> toByteArray(Serializer obj) async {
  ByteSink out = ByteSink();
  obj.toByteArrayStream(out);
  out.close();
  return out.bytes;
}