executeWithFuture method
Executes 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> executeWithFuture([TParam? param]) {
assert(
this is CommandAsync || this is UndoableCommand,
'executeWithFuture can\t be used with synchronous Commands',
);
if (_futureCompleter != null && !_futureCompleter!.isCompleted) {
return _futureCompleter!.future;
}
_futureCompleter = Completer<TResult>();
execute(param);
return _futureCompleter!.future;
}