call abstract method

Future<Result> call(
  1. Command command,
  2. WidgetController prober,
  3. CreateFinderFactory finderFactory,
  4. CommandHandlerFactory handlerFactory
)

Calls action for given command. Returns action Result. Invoke prober functions to perform widget actions. Use finderFactory to create Finders from SerializableFinder. Call handlerFactory to invoke other Commands or CommandWithTargets.

The following example shows invoking nested command with handlerFactory.

@override
Future<Result> call(Command command, WidgetController prober, CreateFinderFactory finderFactory, CommandHandlerFactory handlerFactory) async {
  final StubNestedCommand stubCommand = command as StubNestedCommand;
  for (int i = 0; i < stubCommand.times; i++) {
    await handlerFactory.handleCommand(Tap(stubCommand.finder), prober, finderFactory);
  }
  return const StubCommandResult('stub response');
}

Check the example below for direct WidgetController usage with prober:

  @override
Future<Result> call(Command command, WidgetController prober, CreateFinderFactory finderFactory, CommandHandlerFactory handlerFactory) async {
  final StubProberCommand stubCommand = command as StubProberCommand;
  for (int i = 0; i < stubCommand.times; i++) {
    await prober.tap(finderFactory.createFinder(stubCommand.finder));
  }
  return const StubCommandResult('stub response');
}

Implementation

Future<Result> call(Command command, WidgetController prober, CreateFinderFactory finderFactory, CommandHandlerFactory handlerFactory);