toHex method

String toHex({
  1. bool upperCase = false,
})

Converts this number to its hexadecimal string representation.

255.toHex() // 'ff'

Implementation

String toHex({bool upperCase = false}) {
  final s = toInt().toRadixString(16);
  return upperCase ? s.toUpperCase() : s;
}