RestorationScope 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:



RestorationScope({Key key, @required String restorationId, @required Widget child})
Creates a RestorationScope. [...]


child Widget
The widget below this widget in the tree. [...]
hashCode int
The hash code for this object. [...]
@nonVirtual, read-only, inherited
key Key
Controls how one widget replaces another widget in the tree. [...]
final, inherited
restorationId String
The restoration ID used by this widget to obtain a child bucket from the surrounding RestorationScope. [...]
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited


createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree. [...]
createState() State<RestorationScope>
Creates the mutable state for this widget at a given location in the tree. [...]
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children. [...]
@protected, inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
toDiagnosticsNode({String name, DiagnosticsTreeStyle style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep. [...]
toString({DiagnosticLevel minLevel:}) String
Returns a string representation of this object.
toStringDeep({String prefixLineOne: '', String prefixOtherLines, DiagnosticLevel minLevel: DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants. [...]
toStringShallow({String joiner: ', ', DiagnosticLevel minLevel: DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object. [...]
toStringShort() String
A short, textual description of this widget.


operator ==(Object other) bool
The equality operator. [...]
@nonVirtual, inherited

Static Methods

of(BuildContext context) RestorationBucket
Returns the RestorationBucket inserted into the widget tree by the closest ancestor RestorationScope of context. [...]