aHexColor property
Color
get
aHexColor
AHex string directly to color.
Avoid users copying hexadecimal values that cannot be used directly.
Implementation
Color get aHexColor {
assert(isNotEmpty, 'Conversion string cannot be empty.');
String value = this;
if (value.contains(' ')) {
value = replaceAll(' ', '');
}
if (value.startsWith('#')) {
value = value.substring(1);
}
assert(value.length == 8,
'The length of the string is illegal, the legal length is 8.');
return Color(int.parse(value, radix: 16));
}