Dispose TextEditingController in IndexedStack example#186375
Conversation
|
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. |
There was a problem hiding this comment.
Code Review
This pull request adds a dispose method to the _IndexedStackExampleState class in examples/api/lib/widgets/basic/indexed_stack.0.dart. This implementation ensures that the TextEditingController is properly disposed of when the widget is removed from the tree, preventing potential memory leaks. I have no feedback to provide.
The _IndexedStackExampleState class created a TextEditingController but never disposed it, causing a resource leak. Added dispose() to properly clean up the controller when the widget is removed from the tree. Fixes flutter#186324
90202a9 to
34e70f7
Compare
flutter/flutter@1ceffd1...3598686 2026-05-17 [email protected] Roll Fuchsia Linux SDK from G9xv1qcMhvXOy-9pk... to 5Ki-dBY4SpWdQMF_3... (flutter/flutter#186636) 2026-05-17 [email protected] [Impeller] Canonicalize uniform block instance names for the GL backends (flutter/flutter#186394) 2026-05-16 [email protected] [widgets] Use super parameters in missed spots (flutter/flutter#186198) 2026-05-16 [email protected] refactor: Remove material imports from Widget tests (flutter/flutter#185078) 2026-05-16 [email protected] Roll pub packages (flutter/flutter#186602) 2026-05-16 [email protected] [gn] Fix typo in comment (flutter/flutter#186549) 2026-05-16 [email protected] Roll Fuchsia Linux SDK from y6uQHA5xUN83IF395... to G9xv1qcMhvXOy-9pk... (flutter/flutter#186599) 2026-05-15 [email protected] Removes bringup from passing macos/sdf tests (flutter/flutter#186527) 2026-05-15 [email protected] [web] Fix several WebParagraph bugs (flutter/flutter#186403) 2026-05-15 [email protected] Display the team ID and name when selecting a signing certificate (flutter/flutter#184665) 2026-05-15 [email protected] [iOS] Improve documentation on FlutterVSyncClient and FlutterDisplayLink (flutter/flutter#186456) 2026-05-15 [email protected] Increase the run time of text field integration tests to 10 seconds (flutter/flutter#186475) 2026-05-15 [email protected] Fix web-server hot restart/reload not applying changes for entrypoints outside lib (flutter/flutter#183838) 2026-05-15 [email protected] Update dart_skills_lint dependency to e449787 and optimize skills validation test (flutter/flutter#186528) 2026-05-15 [email protected] Roll Packages from 2ec2236 to 32c84d6 (3 revisions) (flutter/flutter#186583) 2026-05-15 [email protected] Dispose TextEditingController in IndexedStack example (flutter/flutter#186375) 2026-05-15 [email protected] refactor: update filename for sliver semantic widget (flutter/flutter#185917) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…r#11724) flutter/flutter@1ceffd1...3598686 2026-05-17 [email protected] Roll Fuchsia Linux SDK from G9xv1qcMhvXOy-9pk... to 5Ki-dBY4SpWdQMF_3... (flutter/flutter#186636) 2026-05-17 [email protected] [Impeller] Canonicalize uniform block instance names for the GL backends (flutter/flutter#186394) 2026-05-16 [email protected] [widgets] Use super parameters in missed spots (flutter/flutter#186198) 2026-05-16 [email protected] refactor: Remove material imports from Widget tests (flutter/flutter#185078) 2026-05-16 [email protected] Roll pub packages (flutter/flutter#186602) 2026-05-16 [email protected] [gn] Fix typo in comment (flutter/flutter#186549) 2026-05-16 [email protected] Roll Fuchsia Linux SDK from y6uQHA5xUN83IF395... to G9xv1qcMhvXOy-9pk... (flutter/flutter#186599) 2026-05-15 [email protected] Removes bringup from passing macos/sdf tests (flutter/flutter#186527) 2026-05-15 [email protected] [web] Fix several WebParagraph bugs (flutter/flutter#186403) 2026-05-15 [email protected] Display the team ID and name when selecting a signing certificate (flutter/flutter#184665) 2026-05-15 [email protected] [iOS] Improve documentation on FlutterVSyncClient and FlutterDisplayLink (flutter/flutter#186456) 2026-05-15 [email protected] Increase the run time of text field integration tests to 10 seconds (flutter/flutter#186475) 2026-05-15 [email protected] Fix web-server hot restart/reload not applying changes for entrypoints outside lib (flutter/flutter#183838) 2026-05-15 [email protected] Update dart_skills_lint dependency to e449787 and optimize skills validation test (flutter/flutter#186528) 2026-05-15 [email protected] Roll Packages from 2ec2236 to 32c84d6 (3 revisions) (flutter/flutter#186583) 2026-05-15 [email protected] Dispose TextEditingController in IndexedStack example (flutter/flutter#186375) 2026-05-15 [email protected] refactor: update filename for sliver semantic widget (flutter/flutter#185917) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Description
The
_IndexedStackExampleStateclass in theIndexedStackAPI example creates aTextEditingControllerbut never disposes it, causing a resource leak.Added a
dispose()override that callsfieldText.dispose()beforesuper.dispose().Fixes #186324
Tests
Existing tests in
examples/api/test/widgets/basic/indexed_stack.0_test.dartcover the example. No new tests needed for a dispose fix.