fromJson static method

IrColor fromJson(
  1. Object? json
)

A hex string, or {"value": hex, "token": name} for token colors.

Implementation

static IrColor fromJson(Object? json) => switch (json) {
  String hex => IrColor.fromHex(hex),
  {'value': String hex, 'token': String token} => IrColor.fromHex(
    hex,
    token: token,
  ),
  _ => throw FormatException('Bad color: $json'),
};