dart2wasm experiment is opted in by default (#9530)

diff --git a/packages/devtools_app/lib/src/framework/scaffold/settings_dialog.dart b/packages/devtools_app/lib/src/framework/scaffold/settings_dialog.dart
index b9250f7..40b40f5 100644
--- a/packages/devtools_app/lib/src/framework/scaffold/settings_dialog.dart
+++ b/packages/devtools_app/lib/src/framework/scaffold/settings_dialog.dart
@@ -82,7 +82,7 @@
             ...dialogSubHeader(theme, 'Experimental features'),
             Flexible(
               child: CheckboxSetting(
-                title: 'Enable WebAssembly',
+                title: '[Recommended] Enable WebAssembly',
                 description:
                     'This will trigger a reload of the page to load DevTools '
                     'compiled with WebAssembly. This may yield better '
diff --git a/packages/devtools_app/lib/src/shared/managers/banner_messages.dart b/packages/devtools_app/lib/src/shared/managers/banner_messages.dart
index 45e0b77..c3fc64a 100644
--- a/packages/devtools_app/lib/src/shared/managers/banner_messages.dart
+++ b/packages/devtools_app/lib/src/shared/managers/banner_messages.dart
@@ -545,39 +545,6 @@
       );
 }
 
-class WasmWelcomeMessage extends BannerInfo {
-  WasmWelcomeMessage()
-    : super(
-        key: const Key('WasmWelcomeMessage'),
-        screenId: universalScreenId,
-        dismissOnConnectionChanges: true,
-        buildTextSpans: (context) => [
-          const TextSpan(
-            text:
-                '🚀 A faster and more performant DevTools is now available on WebAssembly! Click ',
-          ),
-          const TextSpan(
-            text: 'Enable',
-            style: TextStyle(fontWeight: FontWeight.bold),
-          ),
-          const TextSpan(text: ' to try it out now.'),
-          const TextSpan(
-            text: ' Please note that this will trigger a reload of DevTools.',
-            style: TextStyle(fontStyle: FontStyle.italic),
-          ),
-        ],
-        buildActions: (context) => [
-          DevToolsButton(
-            label: 'Enable',
-            onPressed: () async {
-              await preferences.enableWasmInStorage();
-              webReload();
-            },
-          ),
-        ],
-      );
-}
-
 void maybePushDebugModePerformanceMessage(String screenId) {
   if (offlineDataController.showingOfflineData.value) return;
   if (serviceConnection.serviceManager.connectedApp?.isDebugFlutterAppNow ??
@@ -610,10 +577,6 @@
   bannerMessages.addMessage(WelcomeToNewInspectorMessage(screenId: screenId));
 }
 
-void pushWasmWelcomeMessage() {
-  bannerMessages.addMessage(WasmWelcomeMessage());
-}
-
 extension BannerMessageThemeExtension on ThemeData {
   TextStyle get warningMessageLinkStyle => regularTextStyle.copyWith(
     decoration: TextDecoration.underline,
diff --git a/packages/devtools_app/lib/src/shared/preferences/preferences.dart b/packages/devtools_app/lib/src/shared/preferences/preferences.dart
index 32422f1..eb9730a 100644
--- a/packages/devtools_app/lib/src/shared/preferences/preferences.dart
+++ b/packages/devtools_app/lib/src/shared/preferences/preferences.dart
@@ -19,7 +19,6 @@
 import '../diagnostics/inspector_service.dart';
 import '../feature_flags.dart';
 import '../globals.dart';
-import '../managers/banner_messages.dart';
 import '../primitives/query_parameters.dart';
 import '../server/server.dart';
 import '../utils/utils.dart';
@@ -38,7 +37,11 @@
 
 /// DevTools preferences for experimental features.
 enum _ExperimentPreferences {
-  wasm;
+  /// Deprecated, we ignore this key in favor of [wasmOptOut].
+  wasm,
+
+  /// Whether a user has opted out of the dart2wasm experiment.
+  wasmOptOut;
 
   String get storageKey => '$storagePrefix.$name';
 
@@ -66,8 +69,6 @@
 /// A controller for global application preferences.
 class PreferencesController extends DisposableController
     with AutoDisposeControllerMixin {
-  static const _welcomeShownStorageId = 'wasmWelcomeShown';
-
   /// Whether the user preference for DevTools theme is set to dark mode.
   ///
   /// To check whether DevTools is using a light or dark theme, other parts of
@@ -191,25 +192,13 @@
       );
     }
 
-    // Maybe show the WASM welcome message on app connection if this is the
-    // first time the user is loading DevTools after the WASM experiment was
-    // enabled.
-    addAutoDisposeListener(
-      serviceConnection.serviceManager.connectedState,
-      () async {
-        if (serviceConnection.serviceManager.connectedState.value.connected) {
-          await _maybeShowWasmWelcomeMessage();
-        }
-      },
-    );
-
     addAutoDisposeListener(wasmEnabled, () async {
       final enabled = wasmEnabled.value;
       _log.fine('preference update (wasmEnabled = $enabled)');
 
       await storage.setValue(
-        _ExperimentPreferences.wasm.storageKey,
-        '$enabled',
+        _ExperimentPreferences.wasmOptOut.storageKey,
+        '${!enabled}',
       );
 
       // Update the wasm mode query parameter if it does not match the value of
@@ -227,10 +216,12 @@
       }
     });
 
-    final enabledFromStorage = await boolValueFromStorage(
-      _ExperimentPreferences.wasm.storageKey,
+    final optOutFromStorage = await boolValueFromStorage(
+      _ExperimentPreferences.wasmOptOut.storageKey,
       defaultsTo: false,
     );
+    final enabledFromStorage = !optOutFromStorage;
+
     final queryParams = DevToolsQueryParams.load();
     final enabledFromQueryParams = queryParams.useWasm;
 
@@ -269,23 +260,6 @@
     toggleWasmEnabled(shouldEnableWasm);
   }
 
-  Future<void> _maybeShowWasmWelcomeMessage() async {
-    // If we have already shown the welcome message, don't show it again.
-    final welcomeAlreadyShown = await storage.getValue(_welcomeShownStorageId);
-    if (welcomeAlreadyShown == 'true') return;
-
-    // Show the welcome message if the WASM experiment is enabled but the user
-    // is not using the WASM build.
-    final connectedApp = serviceConnection.serviceManager.connectedApp;
-    if (connectedApp != null &&
-        FeatureFlags.wasmByDefault.isEnabled(connectedApp) &&
-        !kIsWasm) {
-      // Mark the welcome message as shown.
-      await storage.setValue(_welcomeShownStorageId, 'true');
-      pushWasmWelcomeMessage();
-    }
-  }
-
   Future<void> _initVerboseLogging() async {
     final verboseLoggingEnabledValue = await boolValueFromStorage(
       _GeneralPreferences.verboseLogging.name,
diff --git a/packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md b/packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md
index f10234d..52823a5 100644
--- a/packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md
+++ b/packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md
@@ -15,7 +15,7 @@
 
 ## General updates
 
-TODO: Remove this section if there are not any general updates.
+- Switched default compiler for DevTools to `dart2wasm`. - [#9530](https://github.com/flutter/devtools/pull/9530)
 
 ## Inspector updates
 
diff --git a/packages/devtools_app/web/flutter_bootstrap.js b/packages/devtools_app/web/flutter_bootstrap.js
index 59b0b9e..dc563c3 100644
--- a/packages/devtools_app/web/flutter_bootstrap.js
+++ b/packages/devtools_app/web/flutter_bootstrap.js
@@ -33,12 +33,12 @@
 }
 
 // Calls the DevTools server API to read the user's wasm preference.
-async function getDevToolsWasmPreference() {
+async function getDevToolsWasmOptOutPreference() {
   // Note: when the DevTools server is running on a different port than the
   // DevTools web app, this request path will be incorrect and the request
   // will fail. This is okay because DevTools cannot be built with WASM when
   // running from `flutter run` anyway.
-  const request = 'api/getPreferenceValue?key=experiment.wasm';
+  const request = 'api/getPreferenceValue?key=experiment.wasmOptOut';
   try {
     const response = await fetch(request);
     if (!response.ok) {
@@ -47,10 +47,10 @@
     }
 
     // The response text should be an encoded boolean value ("true" or "false").
-    const wasmEnabled = JSON.parse(await response.text());
-    return wasmEnabled === true || wasmEnabled === 'true';
+    const isOptedOut = JSON.parse(await response.text());
+    return isOptedOut === true || isOptedOut === 'true';
   } catch (error) {
-    console.error('Error fetching experiment.wasm preference value:', error);
+    console.error('Error fetching experiment.wasmOptOut preference value:', error);
     return false;
   }
 }
@@ -68,9 +68,18 @@
   if (forceUseJs()) {
     return false;
   }
+
   const wasmEnabledFromQueryParameter = getSearchParam(compilerQueryParameterKey) === 'wasm';
-  const wasmEnabledFromDevToolsPreference = await getDevToolsWasmPreference();
-  return wasmEnabledFromQueryParameter === true || wasmEnabledFromDevToolsPreference === true;
+  if (wasmEnabledFromQueryParameter) {
+    return true;
+  }
+
+  const userHasOptedOut = await getDevToolsWasmOptOutPreference();
+  if (userHasOptedOut) {
+    return false;
+  }
+  
+  return true;
 }
 
 // Sets or removes the 'wasm' query parameter based on whether DevTools should