runOnce method Null safety

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