Scope class abstract
This is an abstract interface for a custom developer interface that is considered to be implemented by their BaseScopeContainer.
For example, you have a ScopeContainer:
class SomeScopeContainer extends ScopeContainer { late final appManagerDep = dep(() => AppManager());
late final navigationDep = dep(() => Navigation());
late final reporterDep = dep(() => Reporter()); }
But you don't want to share actual deps with your consumers or you don't want them to know anything about your SomeScopeContainer implementation.
Then you create an interface:
abstract class SomeScope implements BaseScope { AppManager get appManager;
NavigationManager get navigationManager; }
and implement it by your SomeScopeContainer:
class SomeScopeContainer extends ScopeContainer implements SomeScope { @override AppManager get appManager => appManagerDep.get;
@override NavigationManager get navigationManager => navigationDep.get;
late final appManagerDep = dep(() => AppManager());
late final navigationDep = dep(() => Navigation());
late final reporterDep = dep(() => Reporter()); }
It helps you in two ways:
- You can now use BaseScopeHolder (or Child/Data/ChildData-ScopeHolder) and pass your interface as a first generic parameter for your ScopeHolder. It narrows access to your deps giving only the contract that is declared by the interface.
- You can pass you interface as a
parent
to your ChildScopeHolder instead of actual BaseScopeContainer implementation. It also narrows access to deps from the parent.
- Implementers
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
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