Pin package:web 0.4.0 (#6750)

* Pin package:web 0.4.0

Now that Flutter main has moved to ^0.4.0, we can pin this
version.
diff --git a/packages/devtools_app/lib/src/extensions/embedded/_controller_web.dart b/packages/devtools_app/lib/src/extensions/embedded/_controller_web.dart
index 57e7ba5..da221ab 100644
--- a/packages/devtools_app/lib/src/extensions/embedded/_controller_web.dart
+++ b/packages/devtools_app/lib/src/extensions/embedded/_controller_web.dart
@@ -74,9 +74,7 @@
     );
     _initialized = true;
 
-    // TODO(kenz): replace with `createIFrameElement` when we upgrade to
-    // package:web ^0.3.1.
-    _extensionIFrame = createElementTag('iframe') as HTMLIFrameElement
+    _extensionIFrame = createIFrameElement()
       // This url is safe because we built it ourselves and it does not include
       // any user input.
       // ignore: unsafe_html
diff --git a/packages/devtools_app/lib/src/screens/performance/panes/timeline_events/perfetto/_perfetto_controller_web.dart b/packages/devtools_app/lib/src/screens/performance/panes/timeline_events/perfetto/_perfetto_controller_web.dart
index 31fd9e9..e4ba4eb 100644
--- a/packages/devtools_app/lib/src/screens/performance/panes/timeline_events/perfetto/_perfetto_controller_web.dart
+++ b/packages/devtools_app/lib/src/screens/performance/panes/timeline_events/perfetto/_perfetto_controller_web.dart
@@ -165,9 +165,7 @@
     );
     _initialized = true;
 
-    // TODO(kenz): replace with `createIFrameElement` when we upgrade to
-    // package:web ^0.3.1.
-    _perfettoIFrame = createElementTag('iframe') as HTMLIFrameElement
+    _perfettoIFrame = createIFrameElement()
       // This url is safe because we built it ourselves and it does not include
       // any user input.
       // ignore: unsafe_html
diff --git a/packages/devtools_app/lib/src/shared/config_specific/analysis_options.yaml b/packages/devtools_app/lib/src/shared/config_specific/analysis_options.yaml
deleted file mode 100644
index 73fe077..0000000
--- a/packages/devtools_app/lib/src/shared/config_specific/analysis_options.yaml
+++ /dev/null
@@ -1,6 +0,0 @@
-include: ../../../../analysis_options.yaml
-
-linter:
-  rules:
-    # For some reasons this doesn't work: https://github.com/dart-lang/linter/issues/4308
-    avoid_web_libraries_in_flutter: false
diff --git a/packages/devtools_app/lib/src/shared/config_specific/import_export/_export_web.dart b/packages/devtools_app/lib/src/shared/config_specific/import_export/_export_web.dart
index a13ece0..5abfde4 100644
--- a/packages/devtools_app/lib/src/shared/config_specific/import_export/_export_web.dart
+++ b/packages/devtools_app/lib/src/shared/config_specific/import_export/_export_web.dart
@@ -23,16 +23,10 @@
     final element = document.createElement('a') as HTMLAnchorElement;
     element.setAttribute(
       'href',
-      // TODO(srujzs): This is necessary in order to support package:web 0.4.0.
-      // This was not needed with 0.3.0, hence the lint.
-      // ignore: avoid-unnecessary-type-casts
       URL.createObjectURL(Blob([content.toJS].toJS) as JSObject),
     );
     element.setAttribute('download', fileName);
     element.style.display = 'none';
-    // TODO(srujzs): This is necessary in order to support package:web 0.4.0.
-    // This was not needed with 0.3.0, hence the lint.
-    // ignore: avoid-unnecessary-type-casts
     (document.body as HTMLBodyElement).append(element as JSAny);
     element.click();
     element.remove();
diff --git a/packages/devtools_app/lib/src/shared/config_specific/notifications/_notifications_web.dart b/packages/devtools_app/lib/src/shared/config_specific/notifications/_notifications_web.dart
index 36e52d1..b0617d2 100644
--- a/packages/devtools_app/lib/src/shared/config_specific/notifications/_notifications_web.dart
+++ b/packages/devtools_app/lib/src/shared/config_specific/notifications/_notifications_web.dart
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be found
 // in the LICENSE file.
 
-import 'dart:js_util';
+import 'dart:js_interop';
 
 import 'package:web/helpers.dart' as web_helpers;
 import 'package:web/web.dart';
@@ -17,9 +17,9 @@
 
   late final web_helpers.Notification _impl;
 
-  static Future<String> requestPermission() {
-    return promiseToFuture(web_helpers.Notification.requestPermission());
-  }
+  static Future<String> requestPermission() async =>
+      ((await web_helpers.Notification.requestPermission().toDart) as JSString)
+          .toDart;
 
   void close() {
     _impl.close();
diff --git a/packages/devtools_app/lib/src/shared/config_specific/post_message/_post_message_web.dart b/packages/devtools_app/lib/src/shared/config_specific/post_message/_post_message_web.dart
index a3a9ae0..eca075b 100644
--- a/packages/devtools_app/lib/src/shared/config_specific/post_message/_post_message_web.dart
+++ b/packages/devtools_app/lib/src/shared/config_specific/post_message/_post_message_web.dart
@@ -2,11 +2,6 @@
 // Use of this source code is governed by a BSD-style license that can be found
 // in the LICENSE file.
 
-// TODO(https://github.com/flutter/devtools/issues/6606): remove this import.
-// This is the final dart:html import in DevTools. In order to remove it, we
-// need to bump the `package:web` version in DevTools to > 0.3.1, but we are
-// blocked on `package:web` rolling into the Flutter SDK.
-import 'dart:html' as html;
 import 'dart:js_interop';
 
 import 'package:web/helpers.dart';
@@ -14,7 +9,7 @@
 import 'post_message.dart';
 
 Stream<PostMessageEvent> get onPostMessage {
-  return html.window.onMessage.map(
+  return window.onMessage.map(
     (message) => PostMessageEvent(
       origin: message.origin,
       data: message.data,
diff --git a/packages/devtools_app/pubspec.yaml b/packages/devtools_app/pubspec.yaml
index 1144949..d207c38 100644
--- a/packages/devtools_app/pubspec.yaml
+++ b/packages/devtools_app/pubspec.yaml
@@ -66,7 +66,7 @@
   vm_service: ^13.0.0
   # TODO https://github.com/dart-lang/sdk/issues/52853 - unpin this version
   vm_snapshot_analysis: 0.7.2
-  web: '>=0.3.0 <0.5.0'
+  web: ^0.4.0
   web_socket_channel: ^2.1.0
   # widget_icons: ^0.0.1
 
diff --git a/packages/devtools_app_shared/pubspec.yaml b/packages/devtools_app_shared/pubspec.yaml
index 216c5e3..23d0874 100644
--- a/packages/devtools_app_shared/pubspec.yaml
+++ b/packages/devtools_app_shared/pubspec.yaml
@@ -16,7 +16,7 @@
   meta: ^1.9.1
   pointer_interceptor: ^0.9.3+3
   vm_service: ^13.0.0
-  web: '>=0.3.0 <0.5.0'
+  web: ^0.4.0
 
 dev_dependencies:
   flutter_lints: ^2.0.3
diff --git a/packages/devtools_extensions/pubspec.yaml b/packages/devtools_extensions/pubspec.yaml
index 7484609..60c22f8 100644
--- a/packages/devtools_extensions/pubspec.yaml
+++ b/packages/devtools_extensions/pubspec.yaml
@@ -21,7 +21,7 @@
   path: ^1.8.0
   logging: ^1.1.1
   vm_service: ^13.0.0
-  web: '>=0.3.0 <0.5.0'
+  web: ^0.4.0
 
 dev_dependencies:
   flutter_driver: