when<R> method

R when<R>(
  1. Map<Enum, R Function()> map
)

A when function for Enums. calling the function corresponding to the Enum of the object.

Implementation

// It takes a [Map] of [Enum]s to functions, and returns the result of
/// calling the function corresponding to the [Enum] of the object.

R when<R>(Map<Enum, R Function()> map) {
  return map[this]!();
}