isHexString function

bool isHexString(
  1. String value, {
  2. int? length,
})

Implementation

bool isHexString(String value, {int? length}) {
  RegExp regExp = RegExp(
    r"^0x[0-9A-Fa-f]*$",
  );
  if (length != null && value.length != 2 + 2 * length) {
    return false;
  }
  return regExp.hasMatch(value);
}