convertToColor function

Color convertToColor(
  1. String color
)

Implementation

Color convertToColor(String color) {
  if (color.runtimeType == String) {
    return Color(getColorCode(color.toString()));
  }

  final colorInt = toInt(color);
  if (colorInt == null) {
    return Colors.black;
  }

  return Color(colorInt);
}