MockCommand<TParam, TResult> constructor

MockCommand<TParam, TResult>({
  1. Stream<bool>? restriction,
  2. bool emitInitialCommandResult = false,
  3. bool emitLastResult = false,
  4. bool emitsLastValueToNewSubscriptions = false,
  5. TResult? initialLastResult,
  6. String? debugName,
})

Factory constructor that can take an optional observable to control if the command can be executet

Implementation

factory MockCommand({
  Stream<bool>? restriction,
  bool emitInitialCommandResult = false,
  bool emitLastResult = false,
  bool emitsLastValueToNewSubscriptions = false,
  TResult? initialLastResult,
  String? debugName,
}) {
  return MockCommand._(
      emitsLastValueToNewSubscriptions
          ? BehaviorSubject<TResult>()
          : PublishSubject<TResult>(),
      restriction,
      emitLastResult,
      false,
      emitInitialCommandResult,
      initialLastResult,
      debugName);
}