runAsync method

Future<TResult> runAsync([
  1. TParam? param
])

Runs an async Command and returns a Future that completes as soon as the Command completes. This is especially useful if you use a RefreshIndicator

Implementation

Future<TResult> runAsync([TParam? param]) {
  assert(
    this is CommandAsync || this is UndoableCommand,
    'runAsync can\t be used with synchronous Commands',
  );
  if (_futureCompleter != null && !_futureCompleter!.isCompleted) {
    return _futureCompleter!.future;
  }
  _futureCompleter = Completer<TResult>();

  run(param);
  return _futureCompleter!.future;
}