@@ -37,6 +37,7 @@ class DwdsInjector {
37
37
final bool _useSseForInjectedClient;
38
38
final bool _emitDebugEvents;
39
39
final bool _isInternalBuild;
40
+ final bool _isFlutterApp;
40
41
41
42
DwdsInjector (
42
43
this ._loadStrategy, {
@@ -45,11 +46,13 @@ class DwdsInjector {
45
46
bool useSseForInjectedClient = true ,
46
47
bool emitDebugEvents = true ,
47
48
bool isInternalBuild = false ,
49
+ bool isFlutterApp = false ,
48
50
}) : _extensionUri = extensionUri,
49
51
_enableDevtoolsLaunch = enableDevtoolsLaunch,
50
52
_useSseForInjectedClient = useSseForInjectedClient,
51
53
_emitDebugEvents = emitDebugEvents,
52
- _isInternalBuild = isInternalBuild;
54
+ _isInternalBuild = isInternalBuild,
55
+ _isFlutterApp = isFlutterApp;
53
56
54
57
/// Returns the embedded dev handler paths.
55
58
///
@@ -115,6 +118,7 @@ class DwdsInjector {
115
118
_enableDevtoolsLaunch,
116
119
_emitDebugEvents,
117
120
_isInternalBuild,
121
+ _isFlutterApp,
118
122
);
119
123
body += await _loadStrategy.bootstrapFor (entrypoint);
120
124
_logger.info ('Injected debugging metadata for '
@@ -140,16 +144,16 @@ class DwdsInjector {
140
144
/// Returns the provided body with the main function hoisted into a global
141
145
/// variable and a snippet of JS that loads the injected client.
142
146
String _injectClientAndHoistMain (
143
- String body,
144
- String appId,
145
- String devHandlerPath,
146
- String entrypointPath,
147
- String ? extensionUri,
148
- LoadStrategy loadStrategy,
149
- bool enableDevtoolsLaunch,
150
- bool emitDebugEvents,
151
- bool isInternalBuild,
152
- ) {
147
+ String body,
148
+ String appId,
149
+ String devHandlerPath,
150
+ String entrypointPath,
151
+ String ? extensionUri,
152
+ LoadStrategy loadStrategy,
153
+ bool enableDevtoolsLaunch,
154
+ bool emitDebugEvents,
155
+ bool isInternalBuild,
156
+ bool isFlutterApp ) {
153
157
final bodyLines = body.split ('\n ' );
154
158
final extensionIndex =
155
159
bodyLines.indexWhere ((line) => line.contains (mainExtensionMarker));
@@ -169,7 +173,8 @@ String _injectClientAndHoistMain(
169
173
loadStrategy,
170
174
enableDevtoolsLaunch,
171
175
emitDebugEvents,
172
- isInternalBuild);
176
+ isInternalBuild,
177
+ isFlutterApp);
173
178
result += '''
174
179
// Injected by dwds for debugging support.
175
180
if(!window.\$ dwdsInitialized) {
@@ -204,6 +209,7 @@ String _injectedClientSnippet(
204
209
bool enableDevtoolsLaunch,
205
210
bool emitDebugEvents,
206
211
bool isInternalBuild,
212
+ bool isFlutterApp,
207
213
) {
208
214
var injectedBody = 'window.\$ dartAppId = "$appId ";\n '
209
215
'window.\$ dartReloadConfiguration = "${loadStrategy .reloadConfiguration }";\n '
@@ -215,6 +221,7 @@ String _injectedClientSnippet(
215
221
'window.\$ dartEntrypointPath = "$entrypointPath ";\n '
216
222
'window.\$ dartEmitDebugEvents = $emitDebugEvents ;\n '
217
223
'window.\$ isInternalBuild = $isInternalBuild ;\n '
224
+ 'window.\$ isFlutterApp = $isFlutterApp ;\n '
218
225
'${loadStrategy .loadClientSnippet (_clientScript )}' ;
219
226
if (extensionUri != null ) {
220
227
injectedBody += 'window.\$ dartExtensionUri = "$extensionUri ";\n ' ;
0 commit comments