cipher.process 返回一个 Uint8List,它是一个无符号整数列表 (0-255)。我需要将此 Uint8List 转换为可以轻松转换回相同 Uint8List 的字符串。
var cipherText = cipher.process( inputAsUint8List );
return ASCII.decode(cipherText);
ASCII.decode 会抛出错误,因为某些整数 > 127。
最佳答案
我想这应该这样做:
String s = new String.fromCharCodes(inputAsUint8List);
var outputAsUint8List = new Uint8List.fromList(s.codeUnits);
关于arrays - 使用 Dart 将 Uint8List 转换为字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28565242/