dispose method Null safety

void dispose()

Deletes the bucket and all the data stored in it from the bucket hierarchy.

After dispose has been called, the data stored in this bucket and its children are no longer part of the app's restoration data. The data originally stored in the bucket will not be available again when the application is restored to this state in the future. It is up to the owners of the children to either move them (via adoptChild) to a new parent that is still part of the bucket hierarchy or to dispose of them as well.

This method must only be called by the object's owner.

Implementation

void dispose() {
  assert(_debugAssertNotDisposed());
  _visitChildren(_dropChild, concurrentModification: true);
  _claimedChildren.clear();
  _childrenToAdd.clear();
  _parent?._removeChildData(this);
  _parent = null;
  _updateManager(null);
  _debugDisposed = true;
}