RestorationScopeModifier class

Creates a new scope for restoration IDs used by descendant widgets to claim RestorationBuckets.

A restoration scope inserts a RestorationBucket into the widget tree, which descendant widgets can access via RestorationScope.of. It is uncommon for descendants to directly store data in this bucket. Instead, descendant widgets should consider storing their own restoration data in a child bucket claimed with RestorationBucket.claimChild from the bucket provided by this scope.

The bucket inserted into the widget tree by this scope has been claimed from the surrounding RestorationScope using the provided restorationId. If the RestorationScope is moved to a different part of the widget tree under a different RestorationScope, the bucket owned by this scope with all its children and the data contained in them is moved to the new scope as well.

This widget will not make a RestorationBucket available to descendants if restorationId is null or when there is no surrounding restoration scope to claim a bucket from. In this case, descendant widgets invoking RestorationScope.of will receive null as a return value indicating that no bucket is available for storing restoration data. This will turn off state restoration for the widget subtree.

See also:

Inheritance
Available extensions

Constructors

RestorationScopeModifier({Key? key, Widget? child, Key? modifierKey, required String? restorationId})
Creates a RestorationScope.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
modifierKey Key?
The actual key of the widget, which Modifier wrapped
finalinherited
restorationId String?
The restoration ID used by this widget to obtain a child bucket from the surrounding RestorationScope.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
inherited
buildWithChild(BuildContext context, Widget? child) Widget
A build method that receives an extra child parameter.
override
createElement() SingleChildStatelessElement
Create a SingleChildStatelessElement
inherited
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
modified() Modifier

Available on Widget, provided by the ModifierTransformer extension

Transform normal widget to Modifier
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() String
A short, textual description of this widget.
inherited

Operators

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