colorFromJson static method

Color colorFromJson(
  1. String colorString
)

Implementation

static Color colorFromJson(String colorString) {
  if (colorString == 'transparent') {
    return Colors.transparent;
  }
  int? intColor = int.tryParse(colorString, radix: 16);
  if (intColor == null) {
    return Colors.black;
  } else {
    return Color(intColor);
  }
}