fakeFlutterRun function

FakeFlutterRun fakeFlutterRun({
  1. String projectRoot = '/game',
  2. String? device = 'macos',
  3. FakeGame? game,
})

A FlutterRun over a FakeFlutterTool, and the arguments each start was given, the working directory first.

game is the VM service the run finds at the address the tool reports, for a test that has the game post events; one that posts nothing when left out.

Implementation

FakeFlutterRun fakeFlutterRun({
  String projectRoot = '/game',
  String? device = 'macos',
  FakeGame? game,
}) {
  final tool = FakeFlutterTool();
  final started = <List<String>>[];
  final reached = game ?? FakeGame();
  return FakeFlutterRun(
    run: FlutterRun(
      projectRoot: projectRoot,
      device: device,
      start: (List<String> arguments, String directory) async {
        started.add(<String>[directory, ...arguments]);
        return tool;
      },
      connect: (String _) async => reached.service,
    ),
    tool: tool,
    started: started,
  );
}