stringToColor static method

Color stringToColor(
  1. String? colorStr
)

Implementation

static Color stringToColor(String? colorStr) {
  if (colorStr != null && colorStr.length > 16) {
    int pos = colorStr.indexOf('0x');
    String key = colorStr.substring(pos + 2, pos + 2 + 8);
    return Color(int.parse(key, radix: 16));
  }
  return Colors.transparent;
}