toPaddedHexString method

String toPaddedHexString()

Convert this Iterable of int to String in the format 0ab0ccf1f2f3 and so on.

Each int in this Iterable gets truncated to a values between 0 and 255, both inclusive. (See Uint8List.fromList)

When an int is converted to a hexadecimal number and its value is less than, or equal to 15 in decimal (0xF), then the hexadecimal representation will be prefixed with a 0 (0x0F).

Implementation

String toPaddedHexString() {
  return map((e) {
    final truncated = e & 0xFF;
    return truncated.toRadixString(16).padLeft(2, "0");
  }).join("");
}