[flutter_tools] ensure allowExistingDdsInstance param is always non-null (#74091)
diff --git a/packages/flutter_tools/lib/src/resident_runner.dart b/packages/flutter_tools/lib/src/resident_runner.dart
index 59243f6..5b9bad2 100644
--- a/packages/flutter_tools/lib/src/resident_runner.dart
+++ b/packages/flutter_tools/lib/src/resident_runner.dart
@@ -222,7 +222,7 @@
int ddsPort,
bool disableServiceAuthCodes = false,
bool disableDds = false,
- bool allowExistingDdsInstance = false,
+ @required bool allowExistingDdsInstance,
bool ipv6 = false,
}) {
final Completer<void> completer = Completer<void>();
@@ -1217,7 +1217,7 @@
Restart restart,
CompileExpression compileExpression,
GetSkSLMethod getSkSLMethod,
- bool allowExistingDdsInstance,
+ @required bool allowExistingDdsInstance,
}) async {
if (!debuggingOptions.debuggingEnabled) {
throw 'The service protocol is not enabled.';
diff --git a/packages/flutter_tools/lib/src/run_cold.dart b/packages/flutter_tools/lib/src/run_cold.dart
index 8410f8e..75fdc72 100644
--- a/packages/flutter_tools/lib/src/run_cold.dart
+++ b/packages/flutter_tools/lib/src/run_cold.dart
@@ -73,7 +73,9 @@
if (debuggingOptions.debuggingEnabled) {
try {
await Future.wait(<Future<void>>[
- connectToServiceProtocol(),
+ connectToServiceProtocol(
+ allowExistingDdsInstance: false,
+ ),
serveDevToolsGracefully(
devToolsServerAddress: debuggingOptions.devToolsServerAddress,
),
diff --git a/packages/flutter_tools/test/general.shard/resident_runner_test.dart b/packages/flutter_tools/test/general.shard/resident_runner_test.dart
index 91d4c58..3166445 100644
--- a/packages/flutter_tools/test/general.shard/resident_runner_test.dart
+++ b/packages/flutter_tools/test/general.shard/resident_runner_test.dart
@@ -197,6 +197,7 @@
restart: anyNamed('restart'),
compileExpression: anyNamed('compileExpression'),
getSkSLMethod: anyNamed('getSkSLMethod'),
+ allowExistingDdsInstance: anyNamed('allowExistingDdsInstance'),
)).thenAnswer((Invocation invocation) async { });
when(mockFlutterDevice.setupDevFS(any, any))
.thenAnswer((Invocation invocation) async {
@@ -2815,7 +2816,7 @@
observatoryUris: Stream<Uri>.value(testUri),
);
- await flutterDevice.connect();
+ await flutterDevice.connect(allowExistingDdsInstance: true);
verify(mockLogReader.connectedVMService = mockVMService);
}, overrides: <Type, Generator>{
VMServiceConnector: () => (Uri httpUri, {