toReadable static method

String toReadable(
  1. Uint8List bytes, {
  2. Radix radix = Radix.hex,
  3. String separator = ' ',
})

字节数组 → 可读字符串。

hex 模式每字节输出两位小写([1,255] → '01 ff'),dec 模式输出 十进制;分隔符默认单个空格。

Implementation

static String toReadable(
  Uint8List bytes, {
  Radix radix = Radix.hex,
  String separator = ' ',
}) {
  return bytes
      .map((b) => radix == Radix.hex
          ? b.toRadixString(16).padLeft(2, '0')
          : b.toString())
      .join(separator);
}