MockCommand<TParam, TResult> constructor

MockCommand<TParam, TResult>({
  1. required TResult initialValue,
  2. bool noParamValue = false,
  3. bool noResult = false,
  4. ValueListenable<bool>? restriction,
  5. bool includeLastResultInCommandResult = false,
  6. bool? catchAlways,
  7. 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 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);
}