rootBucket property

  1. @override
Future<RestorationBucket?> rootBucket
override

The root of the RestorationBucket hierarchy containing the restoration data.

Child buckets can be claimed from this bucket via RestorationBucket.claimChild. If the RestorationManager has been asked to restore the application to a previous state, these buckets will contain the previously stored data. Otherwise the root bucket (and all children claimed from it) will be empty.

The RestorationManager informs its listeners (added via addListener) when the value returned by this getter changes. This happens when new restoration data has been provided to the RestorationManager to restore the application to a different state. In response to the notification, listeners must stop using the old root bucket and obtain the new one via this getter (rootBucket will have been updated to return the new bucket just before the listeners are notified).

The restoration data describing the current bucket hierarchy is retrieved asynchronously from the engine the first time the root bucket is accessed via this getter. After the data has been copied over from the engine, this getter will return a SynchronousFuture, that immediately resolves to the root RestorationBucket.

The returned Future may resolve to null if state restoration is currently turned off.

See also:

Implementation

@override
Future<RestorationBucket?> get rootBucket {
  _debugRootBucketAccessed = true;
  return super.rootBucket;
}