runOnce method

Future<T> runOnce (FutureOr<T> computation())

Runs the function, computation, if it hasn't been run before.

If runOnce has already been called, this returns the original result.

Implementation

Future<T> runOnce(FutureOr<T> computation()) {
  if (!hasRun) _completer.complete(new Future.sync(computation));
  return future;
}