restorePending property Null safety

bool restorePending

Whether restoreState will be called at the beginning of the next build phase.

Returns true when new restoration data has been provided to the mixin, but the registered RestorablePropertys have not been restored to their new values (as described by the new restoration data) yet. The properties will get the values restored when restoreState is invoked at the beginning of the next build cycle.

While this is true, bucket will also still return the old bucket with the old restoration data. It will update to the new bucket with the new data just before restoreState is invoked.

Implementation

bool get restorePending {
  if (_firstRestorePending) {
    return true;
  }
  if (restorationId == null) {
    return false;
  }
  final RestorationBucket? potentialNewParent = RestorationScope.of(context);
  return potentialNewParent != _currentParent && potentialNewParent?.isReplacing == true;
}