rename method Null safety

void rename(
  1. String newRestorationId
)

Changes the restoration ID under which the bucket is (or will be) stored in its parent to newRestorationId.

No-op if the bucket is already stored under the provided id.

If another owner has already claimed a bucket with the provided newId an exception will be thrown at the end of the current frame unless the other owner has deleted its bucket by calling dispose, renameed it using another ID, or has moved it to a new parent via adoptChild.

Implementation

void rename(String newRestorationId) {
  assert(_debugAssertNotDisposed());
  assert(newRestorationId != null);
  if (newRestorationId == restorationId) {
    return;
  }
  _parent?._removeChildData(this);
  _restorationId = newRestorationId;
  _parent?._addChildData(this);
}