runOnce method

Future<List<C2Choice<T>>> runOnce(
  1. FutureOr<List<C2Choice<T>>> computation()
)
inherited

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> Function() computation) {
  if (!hasRun) _completer.complete(Future.sync(computation));
  return future;
}