createAsyncNoParam<TResult> static method
Creates a Command for an asynchronous handler function with no parameter that returns a value
func
: handler function
initialValue
sets the .value
of the Command.
restriction
: ValueListenable<bool>
that can be used to enable/disable the command based on
some other state change. If omitted the command can be executed always except it's already executing
includeLastResultInCommandResults
will include the value of the last successful execution in
all CommandResult
values unless there is no result. This can be handy if you always want to be able
to display something even when you got an error or while the command is still running.
catchAlways
: overrides the default set by catchAlwaysDefault.
If false
, Exceptions thrown by the wrapped function won't be caught but rethrown
unless there is a listener on thrownExceptions or results.
Implementation
static Command<void, TResult> createAsyncNoParam<TResult>(
Future<TResult> Function() func, TResult initialValue,
{ValueListenable<bool>? restriction,
bool includeLastResultInCommandResults = false,
bool? catchAlways,
String? debugName}) {
return CommandAsync<void, TResult>(
null,
func,
initialValue,
restriction,
includeLastResultInCommandResults,
false,
catchAlways,
debugName,
true,
);
}