RestorableEnumN<T extends Enum> constructor

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

Creates a RestorableEnumN.

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

Implementation

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