RestorationBucket.child constructor Null safety
- {required String restorationId,
- required RestorationBucket parent,
- required Object? debugOwner}
Creates a child bucket initialized with the data that the provided
parent
has stored under the provided restorationId
.
This constructor cannot be used if the parent
does not have any child
data stored under the given ID. In that case, create an empty bucket (via
RestorationBucket.empty and have the parent adopt it via adoptChild.
Instantiating a bucket directly is rare, most buckets are created by claiming a child from a parent via claimChild. If no parent bucket is available, RestorationManager.rootBucket may be used as a parent.
The restorationId
and parent
argument must not be null.
Implementation
RestorationBucket.child({
required String restorationId,
required RestorationBucket parent,
required Object? debugOwner,
}) : assert(restorationId != null),
assert(parent != null),
assert(parent._rawChildren[restorationId] != null),
_manager = parent._manager,
_parent = parent,
_rawData = parent._rawChildren[restorationId]! as Map<Object?, Object?>,
_restorationId = restorationId {
assert(() {
_debugOwner = debugOwner;
return true;
}());
}