execute method
Can either be called directly or by calling the object itself because RxCommands are callable classes
Will increase executionCount and assign lastPassedValueToExecute the value of param
If you have queued a result with queueResultsForNextExecuteCall it will be copies tho the output stream.
isExecuting, canExecute and results will work as with a real command.
Implementation
@override
execute([TParam? param]) {
_canExecuteSubject.add(false);
executionCount++;
lastPassedValueToExecute = param;
print("Called Execute");
if (returnValuesForNextExecute != null) {
_commandResultsSubject.addStream(
Stream<CommandResult<TParam, TResult>>.fromIterable(
returnValuesForNextExecute!)
.map(
(data) {
if ((data.isExecuting || data.hasError) &&
_includeLastResultInCommandResults) {
return CommandResult<TParam, TResult>(
param, lastResult, data.error, data.isExecuting);
}
return data;
},
),
);
} else {
print("No values for execution queued");
}
_canExecuteSubject.add(true);
}