RestorationBucket.root constructor Null safety

RestorationBucket.root(
  1. {required RestorationManager manager,
  2. required Map<Object?, Object?>? rawData}
)

Creates the root RestorationBucket for the provided restoration manager.

The rawData must either be null (in which case an empty bucket will be instantiated) or it must be a nested map describing the entire bucket hierarchy in the following format:

{
 'v': {  // key-value pairs
    // * key is a string representation a restoration ID
    // * value is any primitive that can be encoded with [StandardMessageCodec]
   '<restoration-id>: <Object>,
  },
 'c': {  // child buckets
   'restoration-id': <nested map representing a child bucket>
  }
}

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 manager argument must not be null.

Implementation

RestorationBucket.root({
  required RestorationManager manager,
  required Map<Object?, Object?>? rawData,
}) : assert(manager != null),
     _manager = manager,
     _rawData = rawData ?? <Object?, Object?>{},
     _restorationId = 'root' {
  assert(() {
    _debugOwner = manager;
    return true;
  }());
}