Ignore upcoming experimental_member_use warnings.#175969
Ignore upcoming experimental_member_use warnings.#175969stereotype441 merged 1 commit intoflutter:masterfrom
experimental_member_use warnings.#175969Conversation
In an upcoming Dart SDK change (https://dart-review.googlesource.com/c/sdk/+/450970), I intend to add logic to the analyzer for generating a warning if an API marked `@experimental` is used. This will allow experimental analyzer features to be developed without creating a risk of breaking changes downstream. It looks like there are two existing uses of an experimental API in the flutter codebase: the method `XmlDocument.xpath`. This is probably safe, since Flutter pins its use of `package:xml` to an exact version. But to avoid breaking buildbots when the new analyzer logic rolls out, we need to keep Flutter warning-clean. So this PR proactively adds `// ignore:` comments to suppress the upcoming warnings.
There was a problem hiding this comment.
Code Review
This pull request adds // ignore comments to suppress upcoming analyzer warnings for using the experimental XmlDocument.xpath method. While this approach works, I've suggested an alternative that refactors the code to use the stable findAllElements API instead. This change would remove the dependency on an experimental feature and eliminate the need for ignore comments, improving long-term maintainability.
| // ignore: experimental_member_use | ||
| final Iterable<XmlNode> nodes = document.xpath('/Scheme/LaunchAction'); |
There was a problem hiding this comment.
Instead of ignoring the experimental_member_use warning, you can avoid using the experimental xpath method. The non-experimental findAllElements method can be used instead.
While findAllElements searches recursively and is not strictly equivalent to the XPath /Scheme/LaunchAction, it is safe to use here because Xcode scheme files have a known structure where LaunchAction is a direct child of the root Scheme element. This change avoids the experimental API and improves maintainability.
| // ignore: experimental_member_use | |
| final Iterable<XmlNode> nodes = document.xpath('/Scheme/LaunchAction'); | |
| final Iterable<XmlNode> nodes = document.rootElement.findAllElements('LaunchAction'); |
| // ignore: experimental_member_use | ||
| final Iterable<XmlNode> nodes = document.xpath('/Scheme/$action'); |
There was a problem hiding this comment.
Similar to the other change in this PR, you can avoid using the experimental xpath method here. The query /Scheme/$action can be replaced with a non-experimental API call.
Since <Scheme> is the root element, you can use document.rootElement.findAllElements(action) to get the desired nodes. This removes the need for the // ignore comment and makes the code more robust against future changes in the package:xml library.
| // ignore: experimental_member_use | |
| final Iterable<XmlNode> nodes = document.xpath('/Scheme/$action'); | |
| final Iterable<XmlNode> nodes = document.rootElement.findAllElements(action); |
|
I'm happy to follow the suggestions above from @gemini-code-assist, but I'd appreciate confirmation from a human that this is a good idea before proceeding. |
|
Thanks for the feedback, @stereotype441. I understand your request for human confirmation. My suggestions are based on automated analysis and best practices, but a human review is indeed crucial for final approval. My role is to provide automated feedback to help streamline the review process, not to make definitive decisions. Please await a human reviewer's assessment for the final go-ahead. |
bkonyi
left a comment
There was a problem hiding this comment.
LGTM!
I think the recommended changes are safe, but I'm not familiar enough with this XML format to say for sure. I'm fine with landing this with or without the suggested changes, unless someone from @flutter/ios-reviewers can confirm this is a good suggestion.
|
Thanks, Ben! I'm going to go ahead and land this in its current form for now, since the current form of the PR is lower risk and sufficient to unblock my work. I'll watch this thread for a response from @flutter/ios-reviewers, and if they agree with the suggested changes, I'll do a follow-up PR. |
Roll Flutter from 4a04204 to b1a28bc (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 ...
In an upcoming Dart SDK change (https://dart-review.googlesource.com/c/sdk/+/450970), I intend to add logic to the analyzer for generating a warning if an API marked `@experimental` is used. This will allow experimental analyzer features to be developed without creating a risk of breaking changes downstream. It looks like there are two existing uses of an experimental API in the flutter codebase: the method `XmlDocument.xpath`. This is probably safe, since Flutter pins its use of `package:xml` to an exact version. But to avoid breaking buildbots when the new analyzer logic rolls out, we need to keep Flutter warning-clean. So this PR proactively adds `// ignore:` comments to suppress the upcoming warnings. <!-- Thanks for filing a pull request! Reviewers are typically assigned within a week of filing a request. To learn more about code review, see our documentation on Tree Hygiene: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md --> ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [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]. - [ ] I listed at least one issue that this PR fixes in the description above. - [ ] I updated/added relevant documentation (doc comments with `///`). - [ ] I added new tests to check the change I am making, or this PR is [test-exempt]. - [ ] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [ ] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [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
In an upcoming Dart SDK change
(https://dart-review.googlesource.com/c/sdk/+/450970), I intend to add logic to the analyzer for generating a warning if an API marked
@experimentalis used. This will allow experimental analyzer features to be developed without creating a risk of breaking changes downstream.It looks like there are two existing uses of an experimental API in the flutter codebase: the method
XmlDocument.xpath. This is probably safe, since Flutter pins its use ofpackage:xmlto an exact version. But to avoid breaking buildbots when the new analyzer logic rolls out, we need to keep Flutter warning-clean.So this PR proactively adds
// ignore:comments to suppress the upcoming warnings.Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.