run<T> method

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

Implementation

Future<T> run<T>(Future<T> Function() action) {
  final previous = _last;
  final done = Completer<void>();
  _last = done.future;
  return previous.then((_) => action()).whenComplete(done.complete);
}