asciiHex static method

Uint8List asciiHex(
  1. Uint8List input
)

Implementation

static Uint8List asciiHex(Uint8List input) {
  final List<int> out = <int>[];
  int high = -1;
  for (final int byte in input) {
    if (byte == 0x3E) break;
    final int digit = _hexDigit(byte);
    if (digit < 0) continue;
    if (high < 0) {
      high = digit;
    } else {
      out.add((high << 4) | digit);
      high = -1;
    }
  }
  if (high >= 0) out.add(high << 4);
  return Uint8List.fromList(out);
}