colorFromKeyword method Null safety

int colorFromKeyword(
  1. String keyword
)

Lookup colorname keyword in colorKeywords map and return BLACK if the color is not found. Returns color as RGB int.

Implementation

static int colorFromKeyword(String keyword) {
  keyword = keyword.toLowerCase().replaceAll(' ', '');
  return colorKeywords.containsKey(keyword)
      ? colorKeywords[keyword]!
      : colorKeywords['black']!;
}