我有一个存储在Sqllite中的内存镜像,该内存镜像已通过toString()方法转换为String,我想将其转换为Unit8List以在MemoryImage小部件中显示它

最佳答案

codeUnits为您提供一个List<int>Uint8List.fromList(...)List<int>转换为Uint8ListString.fromCharCodes(...)List<int>Uint8List转换为String

List<int> list = 'xxx'.codeUnits;
Uint8List bytes = Uint8List.fromList(list);
String string = String.fromCharCodes(bytes);

10-08 17:31