getHexString function

String getHexString(
  1. int n,
  2. int k
)

Implementation

String getHexString(int n, int k) {
  if (n < 0) {
    n = int.tryParse('0x1' + '00' * k) + n;
  }

  var str = n.toRadixString(16);

  if (str.length % 2 == 1) {
    str = '0' + str;
  }
  return str;
}