MockCommand<TParam, TResult> constructor
MockCommand<TParam, TResult> ({
- required TResult? initialValue,
- bool noParamValue = false,
- bool noReturnValue = false,
- ValueListenable<
bool> ? restriction, - ExecuteInsteadHandler<
TParam> ? ifRestrictedExecuteInstead, - bool includeLastResultInCommandResults = false,
- ErrorFilter? errorFilter,
- bool notifyOnlyWhenValueChanges = false,
- String? debugName,
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 super.initialValue,
super.noParamValue = false,
super.noReturnValue = false,
super.restriction,
super.ifRestrictedExecuteInstead,
super.includeLastResultInCommandResults = false,
super.errorFilter,
super.notifyOnlyWhenValueChanges = false,
super.debugName,
}) {
_commandResult
.where((result) => result.hasData)
.listen((result, _) => value = result.data);
}