scheduleSerializationFor method Null safety

  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.


void scheduleSerializationFor(RestorationBucket bucket) {
  assert(bucket != null);
  assert(bucket._manager == this);
  if (!_serializationScheduled) {
    _serializationScheduled = true;
    SchedulerBinding.instance.addPostFrameCallback((Duration _) => _doSerialization());