From 063ed2aa20c47aa4428770d621eaf67570757fd6 Mon Sep 17 00:00:00 2001 From: Mouad Debbar Date: Mon, 26 Jun 2023 14:45:22 -0400 Subject: [PATCH] Import web-only APIs from dart:ui_web (#5942) These web-only APIs are now exported properly through `dart:ui_web`. Related to: https://github.com/flutter/flutter/issues/126831 --- .../perfetto/_perfetto_controller_web.dart | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) 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 73123012aad..291962b26f7 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 @@ -5,7 +5,7 @@ import 'dart:async'; // ignore: avoid_web_libraries_in_flutter, as designed import 'dart:html' as html; -import 'dart:ui' as ui; +import 'dart:ui_web' as ui_web; import 'package:flutter/foundation.dart'; @@ -31,7 +31,7 @@ const _debugUseLocalPerfetto = false; /// app and for each load of offline data. Each time [PerfettoController.init] /// is called, we create a new [html.IFrameElement] and register it to /// [PerfettoController.viewId] via -/// [ui.platformViewRegistry.registerViewFactory]. Each new [html.IFrameElement] +/// [ui_web.platformViewRegistry.registerViewFactory]. Each new [html.IFrameElement] /// must have a unique id in the [PlatformViewRegistry], which /// [_viewIdIncrementer] is used to create. var _viewIdIncrementer = 0; @@ -123,8 +123,7 @@ class PerfettoControllerImpl extends PerfettoController { origin: html.window.location.origin, path: html.window.location.pathname ?? '', ); - // ignore: undefined_prefixed_name, doesn't understand conditional imports. - final indexFilePath = ui.webOnlyAssetManager + final indexFilePath = ui_web.assetManager .getAssetUrl(devToolsExtensionPoints.perfettoIndexLocation); final baseUrl = '$basePath/$indexFilePath'; return '$baseUrl$_embeddedModeQuery'; @@ -178,10 +177,7 @@ class PerfettoControllerImpl extends PerfettoController { ..height = '100%' ..width = '100%'; - // This ignore is required due to - // https://github.com/flutter/flutter/issues/41563 - // ignore: undefined_prefixed_name - final registered = ui.platformViewRegistry.registerViewFactory( + final registered = ui_web.platformViewRegistry.registerViewFactory( viewId, (int viewId) => _perfettoIFrame, );