Skip to content

Conversation

@muradhossin
Copy link
Contributor

Fixes #172405

On Flutter Web, calling MaterialApp(showPerformanceOverlay: true) reaches
SceneBuilder.addPerformanceOverlay, which previously threw UnimplementedError
and crashed apps. This change makes the method a no-op on Web and logs a one-time
warning:

"showPerformanceOverlay is not supported on Flutter Web. Use DevTools
Performance (Timeline) instead."

Rationale: Avoid crashes and guide developers to the supported tooling on Web.

Testing:

  • Relied on CI for web_ui builds and tests.
  • (Manual reproduction before fix) Enabling showPerformanceOverlay on Web produced
    UnimplementedError from canvaskit/layer_scene_builder.dart.

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

@google-cla
Copy link

google-cla bot commented Aug 10, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@github-actions github-actions bot added engine flutter/engine related. See also e: labels. platform-web Web applications specifically labels Aug 10, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request effectively resolves a crash on Flutter Web when showPerformanceOverlay is enabled. Instead of throwing an UnimplementedError, the method now logs a helpful, one-time warning to the console guiding developers to the correct tools. The change is simple and correct. I've added one suggestion to improve code clarity by marking unused parameters according to Dart conventions.

@mdebbar mdebbar self-requested a review August 20, 2025 18:27
Copy link
Contributor

@mdebbar mdebbar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for the contribution!

Would you mind adding a simple test that does something like this:

final LayerSceneBuilder sb = LayerSceneBuilder();
expect(
  () => sb.addPerformanceOverlay(0, ui.Rect.zero),
  returnsNormally,
);

@mdebbar
Copy link
Contributor

mdebbar commented Aug 21, 2025

Would you mind adding a simple test that does something like this:

final LayerSceneBuilder sb = LayerSceneBuilder();
expect(
  () => sb.addPerformanceOverlay(0, ui.Rect.zero),
  returnsNormally,
);

Bonus points if you also check for the warning message being printed 😃 Here's an example you could copy from:

oldPrintWarning = printWarning;
printWarning = (String warning) {
warnings.add(warning);
};

@muradhossin muradhossin requested a review from mdebbar August 21, 2025 18:07
@muradhossin muradhossin requested a review from mdebbar August 28, 2025 15:27
@mdebbar
Copy link
Contributor

mdebbar commented Aug 28, 2025

Sorry for the confusion. I didn't mean that you should move the file. The file has moved in master, so I wanted you to rebase to pick up the file move.

I fixed it and merged latest master into this PR.

Copy link
Contributor

@mdebbar mdebbar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change looks good to me!

I think the test may fail until #174588 lands. Let's wait for that PR to land, and then let's update this PR and submit it.

Copy link
Contributor

@harryterkelsen harryterkelsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mdebbar mdebbar added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 28, 2025
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Aug 28, 2025
@auto-submit
Copy link
Contributor

auto-submit bot commented Aug 28, 2025

autosubmit label was removed for flutter/flutter/173518, because - The status or check suite Windows windows_unopt has failed. Please fix the issues identified (or deflake) before re-applying this label.

@mdebbar mdebbar added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 28, 2025
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Aug 28, 2025
@auto-submit
Copy link
Contributor

auto-submit bot commented Aug 28, 2025

autosubmit label was removed for flutter/flutter/173518, because - The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label.

@mdebbar mdebbar added autosubmit Merge PR when tree becomes green via auto submit App and removed autosubmit Merge PR when tree becomes green via auto submit App labels Aug 29, 2025
@mdebbar
Copy link
Contributor

mdebbar commented Sep 17, 2025

Waiting for #175392 to land.

@mdebbar mdebbar added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 24, 2025
@auto-submit
Copy link
Contributor

auto-submit bot commented Sep 24, 2025

autosubmit label was removed for flutter/flutter/173518, because - The status or check suite Linux linux_android_debug_engine_ddm has failed. Please fix the issues identified (or deflake) before re-applying this label.

@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Sep 24, 2025
@harryterkelsen harryterkelsen added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 24, 2025
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Sep 24, 2025
@auto-submit
Copy link
Contributor

auto-submit bot commented Sep 24, 2025

autosubmit label was removed for flutter/flutter/173518, because - The status or check suite Mac mac_ios_engine has failed. Please fix the issues identified (or deflake) before re-applying this label.

@harryterkelsen harryterkelsen added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 24, 2025
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Sep 24, 2025
@auto-submit
Copy link
Contributor

auto-submit bot commented Sep 24, 2025

autosubmit label was removed for flutter/flutter/173518, because - The status or check suite Linux linux_fuchsia_tests has failed. Please fix the issues identified (or deflake) before re-applying this label.

@mdebbar mdebbar added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 25, 2025
@auto-submit auto-submit bot added this pull request to the merge queue Sep 25, 2025
Merged via the queue into flutter:master with commit b1a28bc Sep 25, 2025
192 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Sep 25, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 25, 2025
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Sep 25, 2025
Roll Flutter from 4a042046a0f1 to b1a28bc065b0 (44 revisions)

flutter/flutter@4a04204...b1a28bc

2025-09-25 [email protected] web_ui: avoid crash for showPerformanceOverlay; log 'not supported' once (flutter/flutter#173518)
2025-09-25 [email protected] Ignore upcoming `experimental_member_use` warnings. (flutter/flutter#175969)
2025-09-25 [email protected] Roll Skia from 753ce2221ce7 to 55436d87e414 (16 revisions) (flutter/flutter#176004)
2025-09-25 [email protected] Add google_fonts to team-framework triage guidelines (flutter/flutter#175675)
2025-09-25 [email protected] Add tests for InputDecoration borders (M3 and theme normalization) (flutter/flutter#175838)
2025-09-24 [email protected] Update Flutter's templates to use dot shorthands (flutter/flutter#175891)
2025-09-24 [email protected] In Gradle Flutter task, correctly replace '\ ' with ' '. (flutter/flutter#175815)
2025-09-24 [email protected] Cleans up navigator pop and remove logic (flutter/flutter#175612)
2025-09-24 [email protected] Fix docs in `EditableText` (flutter/flutter#175787)
2025-09-24 [email protected] Fixes SemanticsFlags.isLink mis-translated in dart ui ffi (flutter/flutter#175812)
2025-09-24 [email protected] Update AGP/Java/Gradle comparison when using analyze --suggestions (flutter/flutter#175808)
2025-09-24 [email protected] Fix SliverMainAxisGroup SliverEnsureSemantics support (flutter/flutter#175671)
2025-09-24 [email protected] Migrate to `WidgetStateColor` (flutter/flutter#175573)
2025-09-24 [email protected] Make sure that a FlexibleSpaceBar doesn't crash in 0x0 environment (flutter/flutter#175228)
2025-09-24 [email protected] Roll Fuchsia Test Scripts from BWj3yYC74ud58QhN0... to APSBP-sS-3FX69Ihf... (flutter/flutter#175944)
2025-09-24 [email protected] Make sure that a MaterialApp doesn't crash in 0x0 environment (flutter/flutter#173090)
2025-09-24 [email protected] feat(cupertino): Add selectableDayPredicate parameter to CupertinoDatePicker for selectable day control #171332 (flutter/flutter#171334)
2025-09-24 [email protected] Refactor `FlutterInjectorTest` to use lambdas/method reference (flutter/flutter#175777)
2025-09-24 [email protected] Replace curly braces with lambdas in `KeyEventChannelTest` (flutter/flutter#175729)
2025-09-24 [email protected] [ Widget Preview ] Fix filter by file on Windows (flutter/flutter#175783)
2025-09-24 [email protected] use lambda expressions /method reference to fix linter issue in `DartMessengerTest.java` (flutter/flutter#175733)
2025-09-24 [email protected] Roll Packages from 3413b65 to 117bf63 (9 revisions) (flutter/flutter#175935)
2025-09-24 [email protected] refactor code to use method reference and lambdas in `DartMessengerTest.java` (flutter/flutter#175731)
2025-09-24 [email protected] Simplify/fix ordering of asserts in `TextInputPluginTest` (flutter/flutter#175784)
2025-09-24 [email protected] Introduce a getter for `Project` to get `gradle-wrapper.properties` directly   (flutter/flutter#175485)
2025-09-24 [email protected] Change the arguments order in `assertEquals` to fix linter issues (flutter/flutter#175719)
2025-09-24 [email protected] Broken link in NavigationRail documentation (flutter/flutter#175852)
2025-09-24 [email protected] Updates to flutter web triage links (flutter/flutter#175791)
2025-09-24 [email protected] Do not present textures in FlutterMetalLayer if the drawable size changed and the texture's size does not match the new drawable size (flutter/flutter#175450)
2025-09-24 [email protected] Remove comment about trailing commas from templates (flutter/flutter#175864)
2025-09-24 [email protected] Roll Skia from 1c1b19f2ffc3 to 753ce2221ce7 (4 revisions) (flutter/flutter#175909)
2025-09-24 [email protected] Roll Skia from 3191a822cf10 to 1c1b19f2ffc3 (2 revisions) (flutter/flutter#175896)
2025-09-24 [email protected] Roll Skia from cabeab8cb22c to 3191a822cf10 (14 revisions) (flutter/flutter#175894)
2025-09-24 [email protected] Roll Dart SDK from 14b4ced3022a to 899c7340cc4c (4 revisions) (flutter/flutter#175893)
2025-09-24 [email protected] Roll `package:analyzer` forward to `8.2.0`. (flutter/flutter#175849)
2025-09-24 [email protected] Make sure that a VerticalDivider doesn't crash at 0x0 environment (flutter/flutter#174761)
2025-09-24 [email protected] Make sure that Drawer & DrawerHeader don't crash in 0x0 environment (flutter/flutter#174772)
2025-09-24 [email protected] Add an assertion for the relationship between `Visibility.maintainState` and `Visibility.maintainFocusability` (flutter/flutter#175552)
2025-09-24 [email protected] fix: remove final class modifier on MenuController (flutter/flutter#174490)
2025-09-24 [email protected] fix: cupertino sheet broken example with programatic pop (flutter/flutter#175709)
2025-09-24 [email protected] [web] Fix assertion thrown when hot restarting during animation (flutter/flutter#175856)
2025-09-24 [email protected] Add non uniform TableBorder (flutter/flutter#175773)
2025-09-23 [email protected] fix small typo in test docs (flutter/flutter#175776)
2025-09-23 [email protected] Use `assertNull` to simplify code (flutter/flutter#175720)

If this roll has caused a breakage, revert this CL and stop the roller
...
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 12, 2025
reidbaker pushed a commit to AbdeMohlbi/flutter that referenced this pull request Dec 10, 2025
…nce (flutter#173518)

Fixes flutter#172405

On Flutter Web, calling `MaterialApp(showPerformanceOverlay: true)`
reaches
`SceneBuilder.addPerformanceOverlay`, which previously threw
`UnimplementedError`
and crashed apps. This change makes the method a no-op on Web and logs a
one-time
warning:

  "showPerformanceOverlay is not supported on Flutter Web. Use DevTools
   Performance (Timeline) instead."

Rationale: Avoid crashes and guide developers to the supported tooling
on Web.

Testing:
- Relied on CI for web_ui builds and tests.
- (Manual reproduction before fix) Enabling `showPerformanceOverlay` on
Web produced
  UnimplementedError from `canvaskit/layer_scene_builder.dart`.

---------

Co-authored-by: Mouad Debbar <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

engine flutter/engine related. See also e: labels. platform-web Web applications specifically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

showPerformanceOverlay=true in MaterialApp throws UnimplementedError on web with no clear “not supported” message

3 participants