Christopher Fujino | eaf058d | 2019-04-19 08:50:30 -0700 | [diff] [blame] | 1 | # Flutter Attach |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | A Flutter-command that attaches to applications that have been launched |
| 6 | without `flutter run` and provides a HotRunner (enabling hot reload/restart). |
| 7 | |
| 8 | ## Usage |
| 9 | |
Pragya | d95f79f | 2020-07-23 07:01:12 +0530 | [diff] [blame] | 10 | There are three ways for the attach command to discover a running app: |
Christopher Fujino | eaf058d | 2019-04-19 08:50:30 -0700 | [diff] [blame] | 11 | |
Christopher Fujino | eaf058d | 2019-04-19 08:50:30 -0700 | [diff] [blame] | 12 | 1. If the platform is Fuchsia the module name must be provided, e.g. `$ |
| 13 | flutter attach --module=mod_name`. This can be called either before or after |
| 14 | the application is started, attach will poll the device if it cannot |
| 15 | immediately discover the port |
xster | 1376746 | 2020-03-25 16:45:49 -0700 | [diff] [blame] | 16 | 1. On Android and iOS, just running `flutter attach` suffices. Flutter tools |
| 17 | will search for an already running Flutter app or module if available. |
| 18 | Otherwise, the tool will wait for the next Flutter app or module to launch |
| 19 | before attaching. |
Ben Konyi | ecd7518 | 2023-02-28 11:57:04 -0500 | [diff] [blame] | 20 | 1. If the app or module is already running and the specific VM Service port is |
xster | 1376746 | 2020-03-25 16:45:49 -0700 | [diff] [blame] | 21 | known, it can be explicitly provided to attach via the command-line, e.g. |
| 22 | `$ flutter attach --debug-port 12345` |
Christopher Fujino | eaf058d | 2019-04-19 08:50:30 -0700 | [diff] [blame] | 23 | |
| 24 | ## Source |
| 25 | |
Pierre-Louis | 072b887 | 2024-04-17 09:44:23 +0200 | [diff] [blame^] | 26 | See the [source](https://github.com/flutter/flutter/blob/main/packages/flutter_tools/lib/src/commands/attach.dart) for the attach command. |