fromHex static method
String is in the format "aabbcc" or "ffaabbcc" with an optional leading "#".
Implementation
static Color fromHex(String hexString) {
hexString = hexString.toLowerCase();
if (hexString.isEmpty) {
return Color(0XFF000000);
}
final buffer = StringBuffer();
if (hexString.length == 6 || hexString.length == 7) buffer.write('ff');
buffer.write(hexString.replaceFirst('#', ''));
return Color(int.parse(buffer.toString(), radix: 16));
}