MockCommand<TParam, TResult> constructor
MockCommand<TParam, TResult> ({})
constructor that can take an optional ValueListenable
to control if the command can be execute
if the wrapped function has void
as return type noResult
has to be true
Implementation
MockCommand({
required TResult initialValue,
bool noParamValue = false,
bool noResult = false,
ValueListenable<bool>? restriction,
bool includeLastResultInCommandResult = false,
bool? catchAlways,
String? debugName,
}) : super(
initialValue,
restriction,
includeLastResultInCommandResult,
noResult,
catchAlways ?? Command.catchAlwaysDefault,
debugName,
noParamValue) {
_commandResult
.where((result) => result.hasData)
.listen((result, _) => value = result.data);
}