[flutter_tools] Remove web hot reload flag (#185994)

Cleans up the --web-experimental-hot-reload flag. It was added to roll
out the hot reload feature on the web. The option is enabled by default
and when used issues a warning that it will be removed in an upcoming
release.

Removing the ability to disable unblocks the deletion of the code paths
that support compiling and running with the require.js AMD module
system.

This change intentionally leaves behind the code paths and tests that
support the flag to make a potential revert easier. If this change
sticks then cleanup will be handled in followup CLs.

Issue: https://github.com/flutter/flutter/issues/142060

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[AI contribution guidelines]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md

---------

Co-authored-by: Chris Bracken <chris@bracken.jp>
diff --git a/dev/devicelab/bin/tasks/web_benchmarks_ddc.dart b/dev/devicelab/bin/tasks/web_benchmarks_ddc.dart
index 98296ca..7805409 100644
--- a/dev/devicelab/bin/tasks/web_benchmarks_ddc.dart
+++ b/dev/devicelab/bin/tasks/web_benchmarks_ddc.dart
@@ -12,7 +12,7 @@
       useWasm: false,
       forceSingleThreadedSkwasm: false,
       useDdc: true,
-      withHotReload: false,
+      withHotReload: true,
       buildMode: 'debug',
     ));
   });
diff --git a/dev/devicelab/lib/tasks/web_benchmarks.dart b/dev/devicelab/lib/tasks/web_benchmarks.dart
index a43f0f8..335b9e9 100644
--- a/dev/devicelab/lib/tasks/web_benchmarks.dart
+++ b/dev/devicelab/lib/tasks/web_benchmarks.dart
@@ -78,10 +78,7 @@
           '--web-browser-flag=--password-store=basic',
           if (io.Platform.isMacOS) '--web-browser-flag=--use-mock-keychain',
           '--dart-define=FLUTTER_WEB_ENABLE_PROFILING=true',
-          if (benchmarkOptions.withHotReload)
-            '--web-experimental-hot-reload'
-          else
-            '--no-web-experimental-hot-reload',
+          if (!benchmarkOptions.withHotReload) '--no-web-experimental-hot-reload',
           '--no-web-resources-cdn',
           'lib/web_benchmarks_ddc.dart',
         ],
diff --git a/packages/flutter_tools/lib/src/commands/run.dart b/packages/flutter_tools/lib/src/commands/run.dart
index 9dfd90e..ff27612 100644
--- a/packages/flutter_tools/lib/src/commands/run.dart
+++ b/packages/flutter_tools/lib/src/commands/run.dart
@@ -741,26 +741,6 @@
       throwToolExit('Skwasm renderer requires --wasm');
     }
 
-    if (argResults?.wasParsed(FlutterOptions.kWebExperimentalHotReload) ?? false) {
-      final bool webEnableHotReload = boolArg(FlutterOptions.kWebExperimentalHotReload);
-      if (webEnableHotReload) {
-        globals.printWarning(
-          'Hot reload on the web is now enabled by default. '
-          'The "--${FlutterOptions.kWebExperimentalHotReload}" flag is deprecated '
-          'and will be removed in an upcoming release.',
-        );
-      } else {
-        globals.printWarning(
-          'Hot reload on the web is now enabled by default. '
-          'The "--no-${FlutterOptions.kWebExperimentalHotReload}" flag is deprecated '
-          'and will be removed in an upcoming release. '
-          'If your web development workflow depends on disabling hot reload, '
-          'please open an issue explaining why at '
-          'https://github.com/dart-lang/sdk/issues/new?template=5_web_hot_reload.yml.',
-        );
-      }
-    }
-
     final String? flavor = stringArg('flavor');
     final bool flavorsSupportedOnEveryDevice = devices!.every(
       (Device device) => device.supportsFlavors,
diff --git a/packages/flutter_tools/lib/src/runner/flutter_command.dart b/packages/flutter_tools/lib/src/runner/flutter_command.dart
index 1671d15..bbc03a2 100644
--- a/packages/flutter_tools/lib/src/runner/flutter_command.dart
+++ b/packages/flutter_tools/lib/src/runner/flutter_command.dart
@@ -373,14 +373,6 @@
       help: 'Enables expression evaluation in the debugger.',
       hide: !verboseHelp,
     );
-    argParser.addFlag(
-      FlutterOptions.kWebExperimentalHotReload,
-      help:
-          '(deprecated; will be removed in a future release) '
-          'Enables new module format that supports hot reload.',
-      defaultsTo: true,
-      hide: !verboseHelp,
-    );
     argParser.addOption(
       'web-launch-url',
       help:
@@ -1408,13 +1400,6 @@
         extraGenSnapshotOptions.add(flag);
       }
     }
-
-    // TODO(natebiggs): Delete this when new DDC module system is the default.
-    final bool webEnableHotReload =
-        forcedWebEnableHotReload ??
-        (argParser.options.containsKey(FlutterOptions.kWebExperimentalHotReload) &&
-            boolArg(FlutterOptions.kWebExperimentalHotReload));
-
     String? codeSizeDirectory;
     if (argParser.options.containsKey(FlutterOptions.kAnalyzeSize) &&
         boolArg(FlutterOptions.kAnalyzeSize)) {
@@ -1549,7 +1534,7 @@
           argParser.options.containsKey(FlutterOptions.kAssumeInitializeFromDillUpToDate) &&
           boolArg(FlutterOptions.kAssumeInitializeFromDillUpToDate),
       useLocalCanvasKit: useLocalCanvasKit,
-      webEnableHotReload: webEnableHotReload,
+      webEnableHotReload: true,
     );
   }
 
diff --git a/packages/flutter_tools/test/commands.shard/hermetic/run_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/run_test.dart
index 763a8c6..e096756 100644
--- a/packages/flutter_tools/test/commands.shard/hermetic/run_test.dart
+++ b/packages/flutter_tools/test/commands.shard/hermetic/run_test.dart
@@ -1836,6 +1836,8 @@
       final File mainFile = libDir.childFile('main.dart');
       mainFile.writeAsStringSync('void main() {}');
     });
+    // TODO(nshahan): Safe to remove after
+    // https://github.com/flutter/flutter/issues/142060.
     testUsingContext(
       'no warning triggered when web hot reload flag not present',
       () async {
@@ -1877,6 +1879,8 @@
         DeviceManager: () => testDeviceManager,
       },
       initializeFlutterRoot: false,
+      // https://github.com/flutter/flutter/issues/142060
+      skip: true,
     );
 
     testUsingContext(
@@ -1906,6 +1910,8 @@
         DeviceManager: () => testDeviceManager,
       },
       initializeFlutterRoot: false,
+      // https://github.com/flutter/flutter/issues/142060
+      skip: true,
     );
   });
 }
diff --git a/packages/flutter_tools/test/web.shard/expression_evaluation_web_amd_test.dart b/packages/flutter_tools/test/web.shard/expression_evaluation_web_amd_test.dart
deleted file mode 100644
index 6e72fb1..0000000
--- a/packages/flutter_tools/test/web.shard/expression_evaluation_web_amd_test.dart
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2014 The Flutter Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-@Tags(<String>['flutter-test-driver'])
-library;
-
-import '../src/common.dart';
-
-import 'test_data/expression_evaluation_web_common.dart';
-
-void main() async {
-  await testAll(useDDCLibraryBundleFormat: false);
-}
diff --git a/packages/flutter_tools/test/web.shard/hot_reload_chrome_errors_test.dart b/packages/flutter_tools/test/web.shard/hot_reload_chrome_errors_test.dart
index 1ca5a52..08f297e 100644
--- a/packages/flutter_tools/test/web.shard/hot_reload_chrome_errors_test.dart
+++ b/packages/flutter_tools/test/web.shard/hot_reload_chrome_errors_test.dart
@@ -9,8 +9,5 @@
 import '../src/common.dart';
 
 void main() {
-  testAll(
-    chrome: true,
-    additionalCommandArgs: <String>['--web-experimental-hot-reload', '--no-web-resources-cdn'],
-  );
+  testAll(chrome: true, additionalCommandArgs: <String>['--no-web-resources-cdn']);
 }
diff --git a/packages/flutter_tools/test/web.shard/hot_reload_chrome_test.dart b/packages/flutter_tools/test/web.shard/hot_reload_chrome_test.dart
index 2d9c2fd..b3cf4ce 100644
--- a/packages/flutter_tools/test/web.shard/hot_reload_chrome_test.dart
+++ b/packages/flutter_tools/test/web.shard/hot_reload_chrome_test.dart
@@ -9,8 +9,5 @@
 import '../src/common.dart';
 
 void main() {
-  testAll(
-    chrome: true,
-    additionalCommandArgs: <String>['--web-experimental-hot-reload', '--no-web-resources-cdn'],
-  );
+  testAll(chrome: true, additionalCommandArgs: <String>['--no-web-resources-cdn']);
 }
diff --git a/packages/flutter_tools/test/web.shard/hot_reload_with_asset_chrome_test.dart b/packages/flutter_tools/test/web.shard/hot_reload_with_asset_chrome_test.dart
index bb56174..4f83d83 100644
--- a/packages/flutter_tools/test/web.shard/hot_reload_with_asset_chrome_test.dart
+++ b/packages/flutter_tools/test/web.shard/hot_reload_with_asset_chrome_test.dart
@@ -9,8 +9,5 @@
 import '../src/common.dart';
 
 void main() {
-  testAll(
-    chrome: true,
-    additionalCommandArgs: <String>['--web-experimental-hot-reload', '--no-web-resources-cdn'],
-  );
+  testAll(chrome: true, additionalCommandArgs: <String>['--no-web-resources-cdn']);
 }
diff --git a/packages/flutter_tools/test/web.shard/hot_restart_chrome_amd_test.dart b/packages/flutter_tools/test/web.shard/hot_restart_chrome_amd_test.dart
deleted file mode 100644
index c2782df..0000000
--- a/packages/flutter_tools/test/web.shard/hot_restart_chrome_amd_test.dart
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2014 The Flutter Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-@Tags(<String>['flutter-test-driver'])
-library;
-
-import '../src/common.dart';
-
-import 'test_data/hot_restart_chrome_test_common.dart';
-
-void main() async {
-  await testAll(useDDCLibraryBundleFormat: false);
-}
diff --git a/packages/flutter_tools/test/web.shard/stateless_stateful_hot_reload_web_test.dart b/packages/flutter_tools/test/web.shard/stateless_stateful_hot_reload_web_test.dart
index 49f566b..11bb0ed 100644
--- a/packages/flutter_tools/test/web.shard/stateless_stateful_hot_reload_web_test.dart
+++ b/packages/flutter_tools/test/web.shard/stateless_stateful_hot_reload_web_test.dart
@@ -9,8 +9,5 @@
 import '../src/common.dart';
 
 void main() {
-  testAll(
-    chrome: true,
-    additionalCommandArgs: <String>['--web-experimental-hot-reload', '--no-web-resources-cdn'],
-  );
+  testAll(chrome: true, additionalCommandArgs: <String>['--no-web-resources-cdn']);
 }
diff --git a/packages/flutter_tools/test/web.shard/test_data/expression_evaluation_web_common.dart b/packages/flutter_tools/test/web.shard/test_data/expression_evaluation_web_common.dart
index 5bceab9..e709abe 100644
--- a/packages/flutter_tools/test/web.shard/test_data/expression_evaluation_web_common.dart
+++ b/packages/flutter_tools/test/web.shard/test_data/expression_evaluation_web_common.dart
@@ -46,10 +46,7 @@
         additionalCommandArgs: <String>[
           '--verbose',
           '--no-web-resources-cdn',
-          if (useDDCLibraryBundleFormat)
-            '--web-experimental-hot-reload'
-          else
-            '--no-web-experimental-hot-reload',
+          if (!useDDCLibraryBundleFormat) '--no-web-experimental-hot-reload',
         ],
       );
     }
@@ -141,10 +138,7 @@
         additionalCommandArgs: <String>[
           '--verbose',
           '--no-web-resources-cdn',
-          if (useDDCLibraryBundleFormat)
-            '--web-experimental-hot-reload'
-          else
-            '--no-web-experimental-hot-reload',
+          if (!useDDCLibraryBundleFormat) '--no-web-experimental-hot-reload',
         ],
       );
     }
diff --git a/packages/flutter_tools/test/web.shard/test_data/hot_action_outside_lib_chrome_test_common.dart b/packages/flutter_tools/test/web.shard/test_data/hot_action_outside_lib_chrome_test_common.dart
index d5aa4db..6d3a176 100644
--- a/packages/flutter_tools/test/web.shard/test_data/hot_action_outside_lib_chrome_test_common.dart
+++ b/packages/flutter_tools/test/web.shard/test_data/hot_action_outside_lib_chrome_test_common.dart
@@ -44,11 +44,7 @@
     await flutter.run(
       device: GoogleChromeDevice.kChromeDeviceId,
       script: 'integration_test/main.dart',
-      additionalCommandArgs: <String>[
-        '--verbose',
-        '--no-web-resources-cdn',
-        '--web-experimental-hot-reload',
-      ],
+      additionalCommandArgs: <String>['--verbose', '--no-web-resources-cdn'],
     );
 
     final completer = Completer<void>();
diff --git a/packages/flutter_tools/test/web.shard/test_data/hot_restart_chrome_test_common.dart b/packages/flutter_tools/test/web.shard/test_data/hot_restart_chrome_test_common.dart
index 00a30d6..58e37c7 100644
--- a/packages/flutter_tools/test/web.shard/test_data/hot_restart_chrome_test_common.dart
+++ b/packages/flutter_tools/test/web.shard/test_data/hot_restart_chrome_test_common.dart
@@ -14,6 +14,8 @@
 
 import 'hot_reload_index_html_samples.dart';
 
+// TODO(nshahan): Remove useDDCLibraryBundleFormat parameter after
+// https://github.com/flutter/flutter/issues/142060.
 Future<void> testAll({required bool useDDCLibraryBundleFormat}) async {
   await _testProject(
     HotReloadProject(),
@@ -92,10 +94,7 @@
         additionalCommandArgs: <String>[
           '--verbose',
           '--no-web-resources-cdn',
-          if (useDDCLibraryBundleFormat)
-            '--web-experimental-hot-reload'
-          else
-            '--no-web-experimental-hot-reload',
+          if (!useDDCLibraryBundleFormat) '--no-web-experimental-hot-reload',
         ],
       );
       // hot restart works without error