parseColor method
Implementation
Color parseColor({Color defaultColor = Colors.white}) {
if (isEmpty) return defaultColor;
try {
String hex = replaceAll('#', '');
if (hex.length == 6) {
hex = 'FF$hex';
}
return Color(int.parse(hex, radix: 16));
} catch (e) {
return defaultColor;
}
}