AggregateStateStorage<TValue extends Object, TState extends AggregateState<TValue> > constructor
AggregateStateStorage<TValue extends Object, TState extends AggregateState<TValue> > ({
- AggregateStateCreator<
TValue, TState> ? onNew, - AggregateStateStorageSettings settings = AggregateStateStorageSettings.Default,
Default constructor.
If onNew
is not given, AggregateStateCreator
must be registered with AggregateStateTypes.define,
or method newInstance must be overridden.
Implementation
AggregateStateStorage({
AggregateStateCreator<TValue, TState>? onNew,
this.settings = AggregateStateStorageSettings.Default,
}) : _onNew = onNew {
//
// Sanity checks
//
if (_onNew == null && !AggregateStateTypes.containsType(TState)) {
throw UnimplementedError('newInstance is not implemented for $TState');
}
}