track<T> method

Future<T> track<T>(
  1. Future<T> future
)

Implementation

Future<T> track<T>(Future<T> future) {
  pending++;
  unawaited(
    future
        .then<void>(
          (value) {
            if (value != null) lastResult = value;
          },
          onError: (Object error, StackTrace stack) {
            failed = true;
          },
        )
        .whenComplete(() => pending--),
  );
  return future;
}