DataScopeHolder<Container extends DataScopeContainer<Data>, Data extends Object> class abstract

Simple holder for creating BaseDataScopeHolder.

Here is an example:

class DataScopeHolder extends DataScopeHolder<DataScopeContainer, Data> {
   @override
   DataScopeContainer createContainer(Data data) => DataScopeContainer(data: data);
}

You also have to declare DataScopeContainer, see BaseScopeContainer.

Working with scope:

await dataScopeHolder.create(SomeData());
// Scope exists here

await dataScopeHolder.drop();
// Scope does not exist here

If you need to differentiate BaseScopeContainer and it's abstract interface then you better use BaseDataScopeHolder directly.

Inheritance

Constructors

DataScopeHolder({@Deprecated('Use scopeObservers instead') List<ScopeListener>? scopeListeners, @Deprecated('Use depObservers instead') List<DepListener>? depListeners, @Deprecated('Use asyncDepObservers instead') List<AsyncDepListener>? asyncDepListeners, List<ScopeObserver>? scopeObservers, List<DepObserver>? depObservers, List<AsyncDepObserver>? asyncDepObservers})

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scope → Container?
no setterinherited
state ScopeState<Container>
no setterinherited
stateStream Stream<ScopeState<Container>>
no setterinherited
stream Stream<Container?>
no setterinherited

Methods

create(Data data) Future<void>
inherited
createContainer(Data data) → Container
inherited
drop() Future<void>
Dispose scope. Scope becomes unavailable.
inherited
init(Container scope) Future<void>
Initialize scope. Scope becomes available and everyone can start working with it via BaseScopeHolder.
inherited
listen(StateListener<Container> listener, {bool emitImmediately = false}) RemoveStateListener
Subscribes to the state.
inherited
listenState(ScopeStateListener<Container> listener, {bool emitImmediately = false}) RemoveStateListener
Subscribes to the state.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited