docs: add Flutter Driver example to MCP server page#13220
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
5f8fdbc to
1a33d89
Compare
|
/gcbrun |
|
Visit the preview URL for this PR (updated for commit 1a33d89): https://flutter-docs-prod--pr13220-doc-mcp-flutter-driver-exam-sg841r6i.web.app |
sfshaza2
left a comment
There was a problem hiding this comment.
lgtm
Any reason we can't move this out of draft and land it?
|
It's not up-to-date anymore. I will update. |
There was a problem hiding this comment.
Code Review
This pull request adds a new section to the documentation detailing how to use the Dart and Flutter MCP server to interact with a running Flutter app. The reviewer provided a suggestion to improve formatting consistency by removing spaces around an em dash.
591e49e to
ed51f41
Compare
Add a third usage example showing how to connect to a running Flutter app and interact with its UI using Flutter Driver via the MCP server.
- Remove --print-dtd from the launch command (auto-discovered via DDS in Flutter ≥3.27; flag no longer needed) - Add explicit web note: flutter_driver doesn't compile under dart2js, pair with a browser-driving MCP for UI actions - Trim wording to keep this section setup-oriented; full reference lives in dart-lang/ai
With `-d chrome`, only the Chrome window Flutter spawns receives hot reload patches; a second browser at the same URL renders the bundle but is invisible to dwds. Spell out the recommendation in the note block so readers don't hit the trap.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Reorder the section so readers see the flag's origin before they hit it on the command line: gate enableFlutterDriverExtension() in main() first, launch with --dart-define second, then prompt the assistant. ENABLE_FLUTTER_DRIVER is a user-defined flag, not a Flutter built-in, so explaining it after the run command read backwards.
7c7144b to
fd3acb7
Compare
parlough
left a comment
There was a problem hiding this comment.
Thanks for this! Some small suggestions and questions:
| ```bash | ||
| flutter run -d <device-id> --dart-define=ENABLE_FLUTTER_DRIVER=true | ||
| ``` |
There was a problem hiding this comment.
To match the setup we use across the site:
| ```bash | |
| flutter run -d <device-id> --dart-define=ENABLE_FLUTTER_DRIVER=true | |
| ``` | |
| ```console | |
| $ flutter run -d <device-id> --dart-define=ENABLE_FLUTTER_DRIVER=true | |
| ``` |
| production builds: | ||
|
|
||
| ```dart | ||
| import 'package:flutter_driver/driver_extension.dart'; |
There was a problem hiding this comment.
Since users might not have flutter_driver added as a dependency, should we suggest adding it first?
```console
$ flutter pub add "flutter_driver:{sdk: flutter}"
```| The agent uses the `dtd` tool to discover the app and `flutter_driver_command` | ||
| to drive its UI—no integration test setup required. |
There was a problem hiding this comment.
Seems we can maybe simplify this?
| The agent uses the `dtd` tool to discover the app and `flutter_driver_command` | |
| to drive its UI—no integration test setup required. | |
| The agent uses the `dtd` tool to discover the app and | |
| `flutter_driver_command` to drive its UI. |
| and common pitfalls. | ||
| ::: | ||
|
|
||
| [flutter-driver-guide]: https://github.com/dart-lang/ai/blob/main/pkgs/dart_mcp_server/README.md#connect-to-a-running-flutter-app |
There was a problem hiding this comment.
I guess this PR should wait to land until the one to dart-lang/ai does for this link?
| agent drives is the one DTD is connected to—with -d chrome, only the | ||
| window Flutter spawned receives hot reload patches. | ||
|
|
||
| See the [setup guide][flutter-driver-guide] for the snippet, web modes, |
| the Dart MCP server with a browser-driving MCP for clicks and screenshots; | ||
| the Dart MCP server still handles widget tree, runtime errors, and hot | ||
| reload through DTD. Prefer `flutter run -d web-server` so the browser the | ||
| agent drives is the one DTD is connected to—with -d chrome, only the |
There was a problem hiding this comment.
| agent drives is the one DTD is connected to—with -d chrome, only the | |
| agent drives is the one DTD is connected to—with `-d chrome`, only the |
| **Web**: the `flutter_driver` package doesn't compile under dart2js. Pair | ||
| the Dart MCP server with a browser-driving MCP for clicks and screenshots; | ||
| the Dart MCP server still handles widget tree, runtime errors, and hot | ||
| reload through DTD. Prefer `flutter run -d web-server` so the browser the |
There was a problem hiding this comment.
I'm a bit confused here. So does this strategy not work with dart2js (release mode) or web as a whole? Since it at first mentions dart2js but here mentioned hot reload, which is not available with dart2js anyway.
Summary
dart-lang/aifor detailsRelated
Test plan
:::notedirective renders as expected🤖 Generated with Claude Code