createAsync1<TParam> method

RxCommand<TParam, void> createAsync1 <TParam>(AsyncAction1<TParam> action, { Observable<bool> canExecute, bool emitInitialCommandResult: false, bool emitsLastValueToNewSubscriptions: false })

Creates a RxCommand for an asynchronous handler function with one parameter and no return type action: handler function canExecute : observable that can bve used to enable/diable the command based on some other state change if omitted the command can be executed always except it's already executing isExecuting will issue a bool value on each state change. Even if you subscribe to a newly created command it will issue false For the Observable<CommandResult> that RxCommand implement this normally doesn't make sense if you want to get an initial Result with data==null, error==null, isExceuting==false pass emitInitialCommandResult=true. By default the results Observable and the RxCommand itself behave like a PublishSubject. If you want that it acts like a BehaviourSubject, meaning every new listener gets the last received value, you can set emitsLastValueToNewSubscriptions = true.

Implementation

static RxCommand<TParam, void> createAsync1<TParam>(AsyncAction1<TParam> action,
    {Observable<bool> canExecute,
    bool emitInitialCommandResult = false,
    bool emitsLastValueToNewSubscriptions = false}) {
  return new RxCommandAsync<TParam, void>((x) async {
    await action(x);
    return null;
  }, canExecute, emitInitialCommandResult, false, emitsLastValueToNewSubscriptions,null);
}