whenOrElse<R> method
Like when, but returns orElse if this enum value is not in map.
final label = status.whenOrElse(
{Status.active: () => 'Active'},
orElse: () => 'Unknown',
);
Implementation
R whenOrElse<R>(
Map<Enum, R Function()> map, {
required R Function() orElse,
}) =>
map.containsKey(this) ? map[this]!() : orElse();