processQueue method

Future<void> processQueue()

Manually starts or joins execution of the synchronization queue.

The queue will only be processed if the device has an active connection. Concurrent callers receive the same processing future.

Implementation

Future<void> processQueue() {
  final active = _processingFuture;
  if (active != null) return active;
  if (_isDisposed || _taskQueue.isEmpty) return Future<void>.value();

  final run = _processQueue();
  _processingFuture = run;
  run.whenComplete(() {
    if (identical(_processingFuture, run)) _processingFuture = null;
  });
  return run;
}