Repository navigation
[cupertino_ui] Fix CupertinoPicker throwing when disposed during the tap-to-select animation - #13012
Merged
auto-submit[bot] merged 1 commit intoOct 10, 2026
Conversation
…d mid tap animation
theprantadutta
marked this pull request as ready for review
October 2, 2026 06:26
Contributor
There was a problem hiding this comment.
Code Review
This pull request fixes an issue where CupertinoPicker throws an exception if it is disposed during the tap-to-select animation. A check is added to verify if the widget is still mounted after the animation completes before accessing the controller's selected item. Additionally, a regression test and a changelog entry are included. There are no review comments, and I have no feedback to provide.
pjkammer
approved these changes
Oct 9, 2026
This was referenced Oct 12, 2026
andywolff
pushed a commit
to andywolff/flutter
that referenced
this pull request
Oct 13, 2026
flutter/packages@d8d9e97...a1ed23c 2026-10-13 [email protected] [material_ui] Clarify Slider labels for continuous sliders (flutter/packages#13121) 2026-10-12 [email protected] [in_app_purchase_storekit] Remove availability checks below the package minimum iOS 13 and macOS 10.15 (flutter/packages#13217) 2026-10-12 [email protected] [google_sign_in] Convert unit tests to Kotlin (flutter/packages#13000) 2026-10-12 [email protected] [vector_graphics_compiler] Support SVG alpha masks (mask-type="alpha") (flutter/packages#13025) 2026-10-11 [email protected] [camera_platform_interface] Add zero-shutter-lag API (flutter/packages#12996) 2026-10-10 [email protected] [material_ui] Ensure textScaler is taken into account for SnackBar action overflow (flutter/packages#12737) 2026-10-10 [email protected] [material_ui] Add more 0x0 size tests part 14 (flutter/packages#13107) 2026-10-10 [email protected] [cupertino_ui] Fix CupertinoPicker throwing when disposed during the tap-to-select animation (flutter/packages#13012) 2026-10-09 [email protected] Roll Flutter (stable) from 5fc3468 to abaf9c5 (3 revisions) (flutter/packages#13186) If this roll has caused a breakage, revert this CL and set the roller to dry run mode using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: 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
suryaKommana2662
pushed a commit
to suryaKommana2662/flutter
that referenced
this pull request
Oct 29, 2026
flutter/packages@d8d9e97...a1ed23c 2026-10-13 [email protected] [material_ui] Clarify Slider labels for continuous sliders (flutter/packages#13121) 2026-10-12 [email protected] [in_app_purchase_storekit] Remove availability checks below the package minimum iOS 13 and macOS 10.15 (flutter/packages#13217) 2026-10-12 [email protected] [google_sign_in] Convert unit tests to Kotlin (flutter/packages#13000) 2026-10-12 [email protected] [vector_graphics_compiler] Support SVG alpha masks (mask-type="alpha") (flutter/packages#13025) 2026-10-11 [email protected] [camera_platform_interface] Add zero-shutter-lag API (flutter/packages#12996) 2026-10-10 [email protected] [material_ui] Ensure textScaler is taken into account for SnackBar action overflow (flutter/packages#12737) 2026-10-10 [email protected] [material_ui] Add more 0x0 size tests part 14 (flutter/packages#13107) 2026-10-10 [email protected] [cupertino_ui] Fix CupertinoPicker throwing when disposed during the tap-to-select animation (flutter/packages#13012) 2026-10-09 [email protected] Roll Flutter (stable) from 5fc3468 to abaf9c5 (3 revisions) (flutter/packages#13186) If this roll has caused a breakage, revert this CL and set the roller to dry run mode using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tapping an item that isn't centred starts a 300 ms tap-to-select animation, which
_CupertinoPickerState._handleChildTapawaits and then reads_effectiveController.selectedItem. If the picker is disposed before that animation finishes, the controller has already been detached, so the read fails: an assertion in debug (FixedExtentScrollController.selectedItem cannot be accessed before a scroll view is built with it.) andStateError: Bad state: No elementin release.It shows up in ordinary "select, then hide" patterns — a parent that removes the picker as soon as a value changes, or a Material bottom sheet (200 ms exit) popped right after a tap. The reporter's analysis in the issue pinned it to this exact line and supplied a deterministic reproduction; credit to them.
The fix returns early after the
awaitwhen the state is no longer mounted. Nothing after that point matters for a disposed picker — it only restores haptic bookkeeping.The new test taps an off-centre item, removes the picker 50 ms into the animation, and pumps past the end. It fails on
mainwith the assertion above and passes with the fix. The rest ofpicker_test.dart(28) anddate_picker_test.dart(85), which covers the pickers built on top ofCupertinoPicker, pass as well.Fixes flutter/flutter#192135
Pre-Review Checklist
[shared_preferences]///).I used AI tooling while working on this, and reviewed and tested all of it myself.
Footnotes
Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2