dart - 将 "uint8list"的字符串转换为 Unit8List

标签 dart flutter

我有一个存储在 Sqllite 中的内存图像使用 toString() 方法转换为字符串,我想将其转换为 Uint8List 以在内存图像小部件中显示它

最佳答案

codeUnits给你一个List<int>
Uint8List.fromList(...)转换 List<int>Uint8List
String.fromCharCodes(...)转换 List<int>Uint8ListString

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

关于dart - 将 "uint8list"的字符串转换为 Unit8List,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51613234/

相关文章:

flutter - 如何在Flutter的末尾显示更多文本来代替Text Overflow.ellipsis?

flutter - 2点和3点抖动

flutter - http.dart onError : Invalid argument (onError): Error handler must accept one Object or one Object and a StackTrace as arguments 的无效参数

dart - 在 aqueduct 和 flutter 之间共享对象

dart - 在 Flutter 中设置环境变量

animation - 如何在 Controller 反向上更改 Flutter 中的 CurvedAnimation?

dart - Dart 中的静态函数 - 只调用一次

image - 如何从 Assets 中为 CircleAvatar 提供图像

android - 必须设置图像 Assets 图标名称

dart - 带有表情符号的自定义 slider