Remove zeros from the end of bytes array.
bytes
static String paddedByteArrayToString(Uint8List? bytes) { return String.fromCharCodes(bytes!).split('\x00')[0]; }