remove<P> method Null safety

P? remove <P>(
  1. String restorationId

Deletes the value currently stored under the provided restorationId from the bucket.

The value removed from the bucket is casted to P and returned. If no value was stored under that id, null is returned.

See also:

  • read, which retrieves a stored value from the bucket.
  • write, which stores a value in the bucket.
  • contains, which checks whether any value is stored under a given restoration ID.


P? remove<P>(String restorationId) {
  assert(restorationId != null);
  final bool needsUpdate = _rawValues.containsKey(restorationId);
  final P? result = _rawValues.remove(restorationId) as P?;
  if (_rawValues.isEmpty) {
  if (needsUpdate) {
  return result;