bool isHex(String value) { return RegExp(r'^(0x|0X)?[a-fA-F0-9]+$').hasMatch(value) && value.length % 2 == 0; }