Scope<W extends Scope<W, D, S> , D extends ScopeDependencies, S extends ScopeState<W, D, S> > class
abstract
base
Scope
A base class for creating scopes with dependency injection and state management.
Extends ScopeCore to provide lifecycle, initialization, and configuration handling.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- ProxyWidget
- InheritedWidget
- ScopeInheritedWidget
- ScopeWidgetCore<
W, _ScopeElement< W, D, S> > - ScopeModelCore<
W, _ScopeElement< W, D, S> , AsyncScopeModel> - AsyncScopeCore<
W, _ScopeElement< W, D, S> > - LiteScopeCore<
W, _ScopeElement< W, D, S> , S> - ScopeCore<
W, _ScopeElement< W, D, S> , D, S> - Scope
Constructors
- Scope({Key? key, Object? tag, Object? scopeKey, Duration? scopeKeyTimeout, void onScopeKeyTimeout()?, Duration? initCancellationTimeout, void onInitCancellationTimeout()?, Duration? disposeScopeTimeout, void onDisposeScopeTimeout()?, Duration? waitForChildrenTimeout, void onWaitForChildrenTimeout()?, Duration? pauseAfterInitialization, Widget child = const _NullWidget()})
-
Creates a scope.
const
Properties
- child → Widget
-
The widget below this widget in the tree.
finalinherited
- disposeScopeTimeout → Duration?
-
How long to wait for each half of the teardown;
nulltakes the default.final - hashCode → int
-
The hash code for this object.
no setterinherited
- initCancellationTimeout → Duration?
-
How long the teardown waits for the initialization to be cancelled;
nulltakes the default.final - key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onDisposeScopeTimeout → void Function()?
-
Called when the wait for the teardown expires.
final
- onInitCancellationTimeout → void Function()?
-
Called when the wait for the cancellation expires.
final
- onScopeKeyTimeout → void Function()?
-
Called when the wait for scopeKey expires.
final
- onWaitForChildrenTimeout → void Function()?
-
Called when the wait for the child scopes expires.
final
- pauseAfterInitialization → Duration?
-
An optional duration to pause after initialization is successful.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scopeKey → Object?
-
A key used to synchronize the initialization of the scope.
final
- scopeKeyTimeout → Duration?
-
How long to wait for scopeKey;
nulltakes the default.final - tag → Object?
-
Names this particular scope in the log.
finalinherited
- waitForChildrenTimeout → Duration?
-
How long to wait for the child scopes;
nulltakes the default.final
Methods
-
buildOnClosing(
BuildContext context) → Widget? - Builds a widget to display while the scope is closing.
-
buildOnError(
BuildContext context, Object error, StackTrace stackTrace, Object? progress) → Widget - Builds a widget to display if an error occurs during initialization.
-
buildOnProgress(
BuildContext context, Object? progress) → Widget - Builds a widget to display while the scope is initializing dependencies.
-
buildOnWaiting(
BuildContext context) → Widget? - Builds a widget to display while waiting for scopeKey and initDependencies to send their first state.
-
createElement(
) → InheritedElement -
Inflates this configuration to a concrete instance.
inherited
-
createScopeElement(
) → _ScopeElement< W, D, S> -
Creates the scope element for this lite scope.
override
-
createState(
) → S - Creates the state for this scope.
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
initDependencies(
BuildContext context) → Stream< ScopeInitState< Object, D> > - Initializes the scope's dependencies and streams the initialization state.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
{bool showHashCode = false}) → String -
A short, textual description of this widget.
inherited
-
updateShouldNotify(
covariant ScopeWidgetCore< W, _ScopeElement< oldWidget) → boolW, D, S> > -
Whether the framework should notify widgets that inherit from this widget.
inherited
-
wrapState(
BuildContext context, D dependencies, Widget child) → Widget - Wraps the state builder with additional widgets, if needed.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
maybeOf<
W extends Scope< (W, D, S> , D extends ScopeDependencies, S extends ScopeState<W, D, S> >BuildContext context) → S? -
Tries to find and return the state
Sof the scopeWfrom the givencontext.override -
of<
W extends Scope< (W, D, S> , D extends ScopeDependencies, S extends ScopeState<W, D, S> >BuildContext context) → S -
Finds and returns the state
Sof the scopeWfrom the givencontext.override -
paramsOf<
W extends Scope< (W, D, S> , D extends ScopeDependencies, S extends ScopeState<W, D, S> >BuildContext context, {required bool listen}) → W -
Looks up and returns the parameters of the scope
W.override -
select<
W extends Scope< (W, D, S> , D extends ScopeDependencies, S extends ScopeState<W, D, S> , V extends Object?>BuildContext context, V selector(S scope)) → V -
Selects and returns a specific value from the state
Sof the scopeWusing theselectorand becomes dependent on it.override -
selectParam<
W extends Scope< (W, D, S> , D extends ScopeDependencies, S extends ScopeState<W, D, S> , V extends Object?>BuildContext context, V selector(W widget)) → V -
Selects and returns a specific parameter of the scope
Wusing theselectorand becomes dependent on it.override