run<T> method

Future<T> run<T>(
  1. Future<T> operation()
)

Schedules operation after all previously scheduled operations settle.

Implementation

Future<T> run<T>(Future<T> Function() operation) {
  final result = _tail.then((_) => operation());
  _tail = result.then<void>(
    (_) {},
    onError: (Object error, StackTrace stack) {},
  );
  return result;
}