hexStripPrefix function

String hexStripPrefix(
  1. String value
)

Implementation

String hexStripPrefix(String value) {
  if (isNull(value)) {
    return '';
  }
  if (hexHasPrefix(value)) {
    return value.substring(2);
  }
  var reg = RegExp(r"^[a-fA-F0-9]+$");

  if (reg.allMatches(value).isNotEmpty) {
    return value;
  }
  throw "Invalid hex $value passed to hexStripPrefix";
}