mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Pass method used to start flutter application (#27812)
This commit is contained in:
parent
b47da6c2b7
commit
23d38901ef
@ -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') {
|
||||
|
Loading…
Reference in New Issue
Block a user