getColor static method

Color getColor(
  1. Map? data,
  2. String key, {
  3. Color defaultValue = Colors.red,
})

Implementation

static Color getColor(
  Map? data,
  String key, {
  Color defaultValue = Colors.red,
}) {
  try {
    String color =
        Methods.getString(data, key, defaultValue: ''); //default COLOR _BLUE
    if (color == '') {
      return defaultValue;
    }
    return HexColor.fromHex(color);
  } catch (ex) {
    return defaultValue;
  }
}