final command = "abcde"
final converted = AsciiEncoder().convert(command)
转[97,98] 0x97,98
蓝牙数据接收
lis[int]
String.fromCharCodes(value)//表示AScii码转字符串
AsciiDecoder().convert(value)//表示AScii码转字符串
蓝牙数据转16进制字符串
String bytesToHex(List<int> bytes) {
String hex = bytes.map((byte) {
String charStr = byte.toRadixString(16).padLeft(2, '0');
print(charStr);
return byte.toRadixString(16).padLeft(2, '0');
}).join();
return hex.toUpperCase(); // 如果需要小写,去掉.toUpperCase()
}