https://api.flutter.dev/flutter/dart-core/String/codeUnits.html
please use it.
or
https://pub.dev/packages/binary_codec library will help you as well
you can use it like this :
/// Encode the generated data
Uint8List encoded = binaryCodec.encode(exampleObject);
/// Decode the encoded data
var decoded = binaryCodec.decode(encoded);
/// Check if they are the same
if (exampleObject.toString() == decoded.toString()) {
/// They should be the same
print('Success');
} else {
/// Else theres a bug in the library
/// Please send the [exampleObject] that leads here and on which
/// platform you are to the author of this library (stefan.zemljic@gmx.ch)
print('Wait... What???');
}