isHexString function
Is the string a hex string.
Implementation
bool isHexString(String value, {int length = 0}) {
ArgumentError.checkNotNull(value);
if (!RegExp('^0x[0-9A-Fa-f]*\$').hasMatch(value)) return false;
if (length > 0 && value.length != 2 + 2 * length) return false;
return true;
}