toHex function

String toHex(
  1. Uint8List bArr
)

Implementation

String toHex(Uint8List bArr) {
  final length = bArr.length;
  if (length <= 0) {
    return '';
  }
  final cArr = Uint8List(length << 1);
  var i = 0;
  for (var i2 = 0; i2 < length; i2++) {
    final i3 = i + 1;
    final cArr2 = [
      '0',
      '1',
      '2',
      '3',
      '4',
      '5',
      '6',
      '7',
      '8',
      '9',
      'a',
      'b',
      'c',
      'd',
      'e',
      'f'
    ];

    final index = (bArr[i2] >> 4) & 15;
    cArr[i] = cArr2[index].codeUnitAt(0);
    i = i3 + 1;
    cArr[i3] = cArr2[bArr[i2] & 15].codeUnitAt(0);
  }
  return String.fromCharCodes(cArr);
}