toHex method
Computes a hexadecimal representation of the barcode, mostly for testing purposes
Implementation
@visibleForTesting
String toHex(String data) {
var intermediate = '';
final matrix = convert(Uint8List.fromList(data.codeUnits));
for (var bit in matrix.pixels) {
intermediate += bit ? '1' : '0';
}
var result = '';
while (intermediate.length > 8) {
final sub = intermediate.substring(intermediate.length - 8);
result += int.parse(sub, radix: 2).toRadixString(16);
intermediate = intermediate.substring(0, intermediate.length - 8);
}
result += int.parse(intermediate, radix: 2).toRadixString(16);
return result;
}