EnumUtils extension

Extensions on Enum for pattern-matching style dispatch.

on

Properties

label String

Available on Enum, provided by the EnumUtils extension

Returns the enum name as a human-readable title case string.
no setter

Methods

when<R>(Map<Enum, R Function()> map) → R

Available on Enum, provided by the EnumUtils extension

Calls the function corresponding to this enum value in map and returns the result.
whenOrElse<R>(Map<Enum, R Function()> map, {required R orElse()}) → R

Available on Enum, provided by the EnumUtils extension

Like when, but returns orElse if this enum value is not in map.