readEnum<T extends Enum> method

T readEnum<T extends Enum>(
  1. dynamic source,
  2. dynamic key,
  3. List<T> values,
  4. T defaultValue,
)

Reads an enumeration value from the source. If not found or in case of an error, it returns the provided defaultValue.

Implementation

T readEnum<T extends Enum>(source, key, List<T> values, T defaultValue) {
  return tryReadEnum<T>(source, key, values) ?? defaultValue;
}