Unverified Commit 23d38901 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

Pass method used to start flutter application (#27812)

parent b47da6c2
......@@ -109,7 +109,7 @@ The `stop()` command takes one parameter, `appId`. It returns a `bool` to indica
#### app.start
This is sent when an app is starting. The `params` field will be a map with the fields `appId`, `directory`, and `deviceId`.
This is sent when an app is starting. The `params` field will be a map with the fields `appId`, `directory`, `deviceId`, and `launchMode`.
#### app.debugPort
......
......@@ -221,6 +221,7 @@ class AttachCommand extends FlutterCommand {
null,
true,
fs.currentDirectory,
LaunchMode.attach,
);
} catch (error) {
throwToolExit(error.toString());
......
......@@ -400,6 +400,7 @@ class AppDomain extends Domain {
projectDirectory,
enableHotReload,
cwd,
LaunchMode.run,
);
}
......@@ -409,7 +410,8 @@ class AppDomain extends Domain {
Device device,
String projectDirectory,
bool enableHotReload,
Directory cwd) async {
Directory cwd,
LaunchMode launchMode) async {
final AppInstance app = AppInstance(_getNewAppId(),
runner: runner, logToStdout: daemon.logToStdout);
_apps.add(app);
......@@ -417,6 +419,7 @@ class AppDomain extends Domain {
'deviceId': device.id,
'directory': projectDirectory,
'supportsRestart': isRestartSupported(enableHotReload, device),
'launchMode': launchMode.toString(),
});
Completer<DebugConnectionInfo> connectionInfoCompleter;
......@@ -1021,3 +1024,19 @@ class LogMessage {
final String message;
final StackTrace stackTrace;
}
/// The method by which the flutter app was launched.
class LaunchMode {
const LaunchMode._(this._value);
/// The app was launched via `flutter run`.
static const LaunchMode run = LaunchMode._('run');
/// The app was launched via `flutter attach`.
static const LaunchMode attach = LaunchMode._('attach');
final String _value;
@override
String toString() => _value;
}
......@@ -42,7 +42,8 @@ Future<void> main() async {
'method': 'app.start',
'params': <String, dynamic> {
'deviceId': words[1],
'projectDirectory': words[2]
'projectDirectory': words[2],
'launchMode': words[3],
}
});
} else if (words.first == 'stop') {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment