Skip to content

Commit 1b39a2e

Browse files
authored
Add basic support for Flutter web applications served with -d web-server (#9468)
Fixes issues where DevTools tries to perform expression evaluation on `dart:io` to determine profile mode status. The DWDS web socket protocol is used with the web-server device, which allows for a subset of the VM service protocol to be made available when a Chrome debug port is unavailable.
1 parent 38116d8 commit 1b39a2e

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

packages/devtools_app_shared/lib/src/service/connected_app.dart

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ class ConnectedApp {
3030
static const isRunningOnDartVMKey = 'isRunningOnDartVM';
3131
static const operatingSystemKey = 'operatingSystem';
3232
static const flutterVersionKey = 'flutterVersion';
33+
static const dwdsChromeDebugProxyDeviceName = 'ChromeDebugProxy';
34+
static const dwdsWebSocketDebugProxyDeviceName = 'WebSocketDebugProxy';
3335

3436
final ServiceManager? serviceManager;
3537

@@ -99,7 +101,12 @@ class ConnectedApp {
99101

100102
bool get isDebugFlutterAppNow => isFlutterAppNow! && !isProfileBuildNow!;
101103

102-
bool? get isRunningOnDartVM => serviceManager!.vm!.name != 'ChromeDebugProxy';
104+
bool? get isRunningOnDartVM {
105+
final name = serviceManager!.vm!.name;
106+
// These are the two possible VM names returned by DWDS.
107+
return name != dwdsChromeDebugProxyDeviceName &&
108+
name != dwdsWebSocketDebugProxyDeviceName;
109+
}
103110

104111
Future<bool> get isDartCliApp async =>
105112
isRunningOnDartVM! && !(await isFlutterApp);

0 commit comments

Comments
 (0)