RestorableEnum<T extends Enum> constructor

RestorableEnum<T extends Enum>(
  1. T defaultValue, {
  2. required Iterable<T> values,
})

Creates a RestorableEnum.

If no restoration data is available to restore the value in this property from, the property will be initialized with the provided defaultValue.

Implementation

RestorableEnum(T defaultValue, { required Iterable<T> values })
  : assert(values.contains(defaultValue),
      'Default value $defaultValue not found in $T values: $values'),
    _defaultValue = defaultValue,
    values = values.toSet();