getColorFromHex static method

Color getColorFromHex(
  1. String colorString
)

Implementation

static Color getColorFromHex(String colorString) {
  // Remove the '#' character if present
  colorString = colorString.replaceAll("#", "");

  // Convert hex string to Color
  return Color(int.parse(colorString, radix: 16) + 0xFF000000);
}