getColorFromStringHex function

Color getColorFromStringHex(
  1. String hex
)

returns a Color object by taking a String hex in the format of "#FFFFFF"

Implementation

Color getColorFromStringHex(String hex) {
  assert(hex.startsWith("#"), 'Hex color needs to start with a # symbol');
  return Color(int.parse(hex.substring(1, 7), radix: 16) + 0xFF000000);
}