scheduleSerializationFor method

  1. @protected
  2. @visibleForTesting
void scheduleSerializationFor(
  1. RestorationBucket bucket
)

Called by a RestorationBucket to request serialization for that bucket.

This method is called by a bucket in the hierarchy whenever the data in it or the shape of the hierarchy has changed.

Calling this is a no-op when the bucket is already scheduled for serialization.

It is exposed to allow testing of RestorationBuckets in isolation.

Implementation

@protected
@visibleForTesting
void scheduleSerializationFor(RestorationBucket bucket) {
  assert(bucket._manager == this);
  assert(!_debugDoingUpdate);
  _bucketsNeedingSerialization.add(bucket);
  if (!_serializationScheduled) {
    _serializationScheduled = true;
    SchedulerBinding.instance.addPostFrameCallback(
      (Duration _) => _doSerialization(),
      debugLabel: 'RestorationManager.doSerialization'
    );
  }
}