toByteArray method
Wrapper function to simplify serialization. @return the serializer object as byte array
Implementation
Future<List<int>>? toByteArray() {
try {
final ByteSink out = ByteSink();
toByteArrayStream(out);
out.close();
return out.bytes;
} on Exception {
return null;
}
}