Skip to content

Fix Carousel crashes when using PageStorageKey - #166817

Merged
auto-submit[bot] merged 1 commit into
flutter:masterfrom
huycozy:fix-carouselview-key-null-exception-166067
Apr 16, 2025
Merged

Fix Carousel crashes when using PageStorageKey#166817
auto-submit[bot] merged 1 commit into
flutter:masterfrom
huycozy:fix-carouselview-key-null-exception-166067

Conversation

@huycozy

Copy link
Copy Markdown
Member
  • FixCarouselView: using PageStorageKey throws Null check operator used on a null value #166067

  • PageStorage is usually used to save and restore offset of scrollable widget when the widget is recreated in practice. From the crash stack trace in bug report, it happens when oldViewportDimensions gets a null value. Tracing it down, it’s due to hasViewportDimension is false. There might be a very brief moment when the scroll metrics are being reconstructed, and the viewport dimensions are not yet ready, which triggers the crash. If a PageStorageKey is not specified, the scroll position would be newly created fresh each time, avoiding this restoration process and the associated null state.

  • The fix is simply to not force casting oldViewportDimensions!, instead, it falls back to viewportDimension which is non-null for safety.

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@huycozyhuycozy self-assigned this Apr 9, 2025
@github-actionsgithub-actionsBot added framework flutter/packages/flutter repository. See also f: labels. p: material_ui material_ui package in flutter/packages labels Apr 9, 2025
@huycozy
huycozyforce-pushed the fix-carouselview-key-null-exception-166067 branch from a1970ce to 6bbeff3CompareApril 9, 2025 09:51
@huycozy
huycozy requested a review from QuncCcccccApril 9, 2025 11:32

@QuncCcccccQuncCccccc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM! Thank you for the explanation in the PR description!

@QuncCcccccQuncCccccc added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 16, 2025
@auto-submit
auto-submitBot added this pull request to the merge queueApr 16, 2025
Merged via the queue into flutter:master with commit 2c516f2Apr 16, 2025
@flutter-dashboardflutter-dashboardBot removed the autosubmit Merge PR when tree becomes green via auto submit App label Apr 16, 2025
@huycozy
huycozy deleted the fix-carouselview-key-null-exception-166067 branch April 17, 2025 02:44
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 17, 2025
auto-submitBot pushed a commit to flutter/packages that referenced this pull request Apr 17, 2025
flutter/flutter@aef4718...ecabb1a
2025-04-17 15619084+vashworth@users.noreply.github.com Hide error on mDNS registration failure and print warning in flutter attach (flutter/flutter#166782)
2025-04-17 bruno.leroux@gmail.com Add support for language hints in TextFields (Android only) (flutter/flutter#165554)
2025-04-17 engine-flutter-autoroll@skia.org Roll Skia from d8f13372549d to cc2b57434651 (1 revision) (flutter/flutter#167331)
2025-04-17 bruno.leroux@gmail.com Add DropdownMenu.restorationId (flutter/flutter#166684)
2025-04-17 engine-flutter-autoroll@skia.org Roll Skia from 3d6165b70199 to d8f13372549d (14 revisions) (flutter/flutter#167325)
2025-04-17 stanleycocoa@gmail.com fix(CircularProgressIndicator.adaptive): strokeWidth default value (flutter/flutter#165370)
2025-04-17 ahmedelsaayid@gmail.com Remove unnecessary builder (flutter/flutter#166623)
2025-04-17 34871572+gmackall@users.noreply.github.com Add a `gradle_errors.dart`entry for missing NDK source.properties file (flutter/flutter#167320)
2025-04-17 engine-flutter-autoroll@skia.org Roll Skia from 6627deb65939 to 3d6165b70199 (1 revision) (flutter/flutter#167255)
2025-04-17 engine-flutter-autoroll@skia.org Manual roll Dart SDK from 87965ab4864e to 992221a362ec (35 revisions) (flutter/flutter#167243)
2025-04-16 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from 7bWzHwIPBTyU6R9nO... to m8Aln7fTF_8zy1V9N... (flutter/flutter#167312)
2025-04-16 15619084+vashworth@users.noreply.github.com Don't throw on error for mDNS when searching for Dart VML url on core devices (flutter/flutter#167135)
2025-04-16 34465683+rkishan516@users.noreply.github.com Fix: Localization for non zero time in 24 hours format (flutter/flutter#164885)
2025-04-16 30870216+gaaclarke@users.noreply.github.com Updated docstrings for TextureContents (flutter/flutter#167221)
2025-04-16 30870216+gaaclarke@users.noreply.github.com Broke cyclical dependency with dlpath and typographer. (flutter/flutter#167293)
2025-04-16 34871572+gmackall@users.noreply.github.com Set an additional CMake arg in `forceNdkDownload` to make the task name align with the `BuildType` (flutter/flutter#167240)
2025-04-16 huy@nevercode.io Fix Carousel crashes when using PageStorageKey (flutter/flutter#166817)
2025-04-16 jason-simmons@users.noreply.github.com Revert "Removed superfluous copy in license checker (#167146)" (flutter/flutter#167246)
2025-04-16 dacoharkes@google.com [native assets] Roll dependencies (flutter/flutter#167287)
2025-04-16 fluttergithubbot@gmail.com Marks Linux_pixel_7pro static_path_stroke_tessellation_perf__timeline_summary to be unflaky (flutter/flutter#167259)
2025-04-16 34465683+rkishan516@users.noreply.github.com Feat: Add carousel view theme (flutter/flutter#164769)
2025-04-16 fluttergithubbot@gmail.com Marks Mac_ios dynamic_path_stroke_tessellation_perf_ios__timeline_summary to be unflaky (flutter/flutter#167261)
2025-04-16 jason-simmons@users.noreply.github.com When using --local-web-sdk, use a locally built Dart SDK if one is available (flutter/flutter#166732)
2025-04-16 30870216+gaaclarke@users.noreply.github.com Added emulator version to doctor (flutter/flutter#167236)
2025-04-16 fluttergithubbot@gmail.com Marks Mac_ios static_path_stroke_tessellation_perf_ios__timeline_summary to be unflaky (flutter/flutter#167260)
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 stuartmorgan@google.com,tarrinneal@google.com 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
ash2moon pushed a commit to ash2moon/flutter that referenced this pull request Apr 21, 2025
- Fixflutter#166067
- PageStorage is usually used to save and restore offset of scrollable
widget when the widget is recreated in practice. From the crash stack
trace in bug report, it happens when [oldViewportDimensions gets a null
value](https://github.com/flutter/flutter/blob/3fa9b387052363e413b906da08c1b1d2d4140dfb/packages/flutter/lib/src/material/carousel.dart#L1472-L1485).
Tracing it down, it’s due to [hasViewportDimension is
false](https://github.com/flutter/flutter/blob/3fa9b387052363e413b906da08c1b1d2d4140dfb/packages/flutter/lib/src/widgets/scroll_position.dart#L275).
There might be a very brief moment when the scroll metrics are being
reconstructed, and the viewport dimensions are not yet ready, which
triggers the crash. If a PageStorageKey is not specified, the scroll
position would be newly created fresh each time, avoiding this
restoration process and the associated null state.
- The fix is simply to not force casting `oldViewportDimensions!`,
instead, it falls back to `viewportDimension` which is non-null for
safety.
## 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].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel
on [Discord].
<!-- 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
CodixNinja pushed a commit to CodixNinja/packages that referenced this pull request May 15, 2025
flutter/flutter@aef4718...ecabb1a
2025-04-17 15619084+vashworth@users.noreply.github.com Hide error on mDNS registration failure and print warning in flutter attach (flutter/flutter#166782)
2025-04-17 bruno.leroux@gmail.com Add support for language hints in TextFields (Android only) (flutter/flutter#165554)
2025-04-17 engine-flutter-autoroll@skia.org Roll Skia from d8f13372549d to cc2b57434651 (1 revision) (flutter/flutter#167331)
2025-04-17 bruno.leroux@gmail.com Add DropdownMenu.restorationId (flutter/flutter#166684)
2025-04-17 engine-flutter-autoroll@skia.org Roll Skia from 3d6165b70199 to d8f13372549d (14 revisions) (flutter/flutter#167325)
2025-04-17 stanleycocoa@gmail.com fix(CircularProgressIndicator.adaptive): strokeWidth default value (flutter/flutter#165370)
2025-04-17 ahmedelsaayid@gmail.com Remove unnecessary builder (flutter/flutter#166623)
2025-04-17 34871572+gmackall@users.noreply.github.com Add a `gradle_errors.dart`entry for missing NDK source.properties file (flutter/flutter#167320)
2025-04-17 engine-flutter-autoroll@skia.org Roll Skia from 6627deb65939 to 3d6165b70199 (1 revision) (flutter/flutter#167255)
2025-04-17 engine-flutter-autoroll@skia.org Manual roll Dart SDK from 87965ab4864e to 992221a362ec (35 revisions) (flutter/flutter#167243)
2025-04-16 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from 7bWzHwIPBTyU6R9nO... to m8Aln7fTF_8zy1V9N... (flutter/flutter#167312)
2025-04-16 15619084+vashworth@users.noreply.github.com Don't throw on error for mDNS when searching for Dart VML url on core devices (flutter/flutter#167135)
2025-04-16 34465683+rkishan516@users.noreply.github.com Fix: Localization for non zero time in 24 hours format (flutter/flutter#164885)
2025-04-16 30870216+gaaclarke@users.noreply.github.com Updated docstrings for TextureContents (flutter/flutter#167221)
2025-04-16 30870216+gaaclarke@users.noreply.github.com Broke cyclical dependency with dlpath and typographer. (flutter/flutter#167293)
2025-04-16 34871572+gmackall@users.noreply.github.com Set an additional CMake arg in `forceNdkDownload` to make the task name align with the `BuildType` (flutter/flutter#167240)
2025-04-16 huy@nevercode.io Fix Carousel crashes when using PageStorageKey (flutter/flutter#166817)
2025-04-16 jason-simmons@users.noreply.github.com Revert "Removed superfluous copy in license checker (#167146)" (flutter/flutter#167246)
2025-04-16 dacoharkes@google.com [native assets] Roll dependencies (flutter/flutter#167287)
2025-04-16 fluttergithubbot@gmail.com Marks Linux_pixel_7pro static_path_stroke_tessellation_perf__timeline_summary to be unflaky (flutter/flutter#167259)
2025-04-16 34465683+rkishan516@users.noreply.github.com Feat: Add carousel view theme (flutter/flutter#164769)
2025-04-16 fluttergithubbot@gmail.com Marks Mac_ios dynamic_path_stroke_tessellation_perf_ios__timeline_summary to be unflaky (flutter/flutter#167261)
2025-04-16 jason-simmons@users.noreply.github.com When using --local-web-sdk, use a locally built Dart SDK if one is available (flutter/flutter#166732)
2025-04-16 30870216+gaaclarke@users.noreply.github.com Added emulator version to doctor (flutter/flutter#167236)
2025-04-16 fluttergithubbot@gmail.com Marks Mac_ios static_path_stroke_tessellation_perf_ios__timeline_summary to be unflaky (flutter/flutter#167260)
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 stuartmorgan@google.com,tarrinneal@google.com 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
androidseb pushed a commit to androidseb/packages that referenced this pull request Jun 8, 2025
flutter/flutter@aef4718...ecabb1a
2025-04-17 15619084+vashworth@users.noreply.github.com Hide error on mDNS registration failure and print warning in flutter attach (flutter/flutter#166782)
2025-04-17 bruno.leroux@gmail.com Add support for language hints in TextFields (Android only) (flutter/flutter#165554)
2025-04-17 engine-flutter-autoroll@skia.org Roll Skia from d8f13372549d to cc2b57434651 (1 revision) (flutter/flutter#167331)
2025-04-17 bruno.leroux@gmail.com Add DropdownMenu.restorationId (flutter/flutter#166684)
2025-04-17 engine-flutter-autoroll@skia.org Roll Skia from 3d6165b70199 to d8f13372549d (14 revisions) (flutter/flutter#167325)
2025-04-17 stanleycocoa@gmail.com fix(CircularProgressIndicator.adaptive): strokeWidth default value (flutter/flutter#165370)
2025-04-17 ahmedelsaayid@gmail.com Remove unnecessary builder (flutter/flutter#166623)
2025-04-17 34871572+gmackall@users.noreply.github.com Add a `gradle_errors.dart`entry for missing NDK source.properties file (flutter/flutter#167320)
2025-04-17 engine-flutter-autoroll@skia.org Roll Skia from 6627deb65939 to 3d6165b70199 (1 revision) (flutter/flutter#167255)
2025-04-17 engine-flutter-autoroll@skia.org Manual roll Dart SDK from 87965ab4864e to 992221a362ec (35 revisions) (flutter/flutter#167243)
2025-04-16 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from 7bWzHwIPBTyU6R9nO... to m8Aln7fTF_8zy1V9N... (flutter/flutter#167312)
2025-04-16 15619084+vashworth@users.noreply.github.com Don't throw on error for mDNS when searching for Dart VML url on core devices (flutter/flutter#167135)
2025-04-16 34465683+rkishan516@users.noreply.github.com Fix: Localization for non zero time in 24 hours format (flutter/flutter#164885)
2025-04-16 30870216+gaaclarke@users.noreply.github.com Updated docstrings for TextureContents (flutter/flutter#167221)
2025-04-16 30870216+gaaclarke@users.noreply.github.com Broke cyclical dependency with dlpath and typographer. (flutter/flutter#167293)
2025-04-16 34871572+gmackall@users.noreply.github.com Set an additional CMake arg in `forceNdkDownload` to make the task name align with the `BuildType` (flutter/flutter#167240)
2025-04-16 huy@nevercode.io Fix Carousel crashes when using PageStorageKey (flutter/flutter#166817)
2025-04-16 jason-simmons@users.noreply.github.com Revert "Removed superfluous copy in license checker (#167146)" (flutter/flutter#167246)
2025-04-16 dacoharkes@google.com [native assets] Roll dependencies (flutter/flutter#167287)
2025-04-16 fluttergithubbot@gmail.com Marks Linux_pixel_7pro static_path_stroke_tessellation_perf__timeline_summary to be unflaky (flutter/flutter#167259)
2025-04-16 34465683+rkishan516@users.noreply.github.com Feat: Add carousel view theme (flutter/flutter#164769)
2025-04-16 fluttergithubbot@gmail.com Marks Mac_ios dynamic_path_stroke_tessellation_perf_ios__timeline_summary to be unflaky (flutter/flutter#167261)
2025-04-16 jason-simmons@users.noreply.github.com When using --local-web-sdk, use a locally built Dart SDK if one is available (flutter/flutter#166732)
2025-04-16 30870216+gaaclarke@users.noreply.github.com Added emulator version to doctor (flutter/flutter#167236)
2025-04-16 fluttergithubbot@gmail.com Marks Mac_ios static_path_stroke_tessellation_perf_ios__timeline_summary to be unflaky (flutter/flutter#167260)
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 stuartmorgan@google.com,tarrinneal@google.com 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
FMorschel pushed a commit to FMorschel/packages that referenced this pull request Jun 9, 2025
flutter/flutter@aef4718...ecabb1a
2025-04-17 15619084+vashworth@users.noreply.github.com Hide error on mDNS registration failure and print warning in flutter attach (flutter/flutter#166782)
2025-04-17 bruno.leroux@gmail.com Add support for language hints in TextFields (Android only) (flutter/flutter#165554)
2025-04-17 engine-flutter-autoroll@skia.org Roll Skia from d8f13372549d to cc2b57434651 (1 revision) (flutter/flutter#167331)
2025-04-17 bruno.leroux@gmail.com Add DropdownMenu.restorationId (flutter/flutter#166684)
2025-04-17 engine-flutter-autoroll@skia.org Roll Skia from 3d6165b70199 to d8f13372549d (14 revisions) (flutter/flutter#167325)
2025-04-17 stanleycocoa@gmail.com fix(CircularProgressIndicator.adaptive): strokeWidth default value (flutter/flutter#165370)
2025-04-17 ahmedelsaayid@gmail.com Remove unnecessary builder (flutter/flutter#166623)
2025-04-17 34871572+gmackall@users.noreply.github.com Add a `gradle_errors.dart`entry for missing NDK source.properties file (flutter/flutter#167320)
2025-04-17 engine-flutter-autoroll@skia.org Roll Skia from 6627deb65939 to 3d6165b70199 (1 revision) (flutter/flutter#167255)
2025-04-17 engine-flutter-autoroll@skia.org Manual roll Dart SDK from 87965ab4864e to 992221a362ec (35 revisions) (flutter/flutter#167243)
2025-04-16 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from 7bWzHwIPBTyU6R9nO... to m8Aln7fTF_8zy1V9N... (flutter/flutter#167312)
2025-04-16 15619084+vashworth@users.noreply.github.com Don't throw on error for mDNS when searching for Dart VML url on core devices (flutter/flutter#167135)
2025-04-16 34465683+rkishan516@users.noreply.github.com Fix: Localization for non zero time in 24 hours format (flutter/flutter#164885)
2025-04-16 30870216+gaaclarke@users.noreply.github.com Updated docstrings for TextureContents (flutter/flutter#167221)
2025-04-16 30870216+gaaclarke@users.noreply.github.com Broke cyclical dependency with dlpath and typographer. (flutter/flutter#167293)
2025-04-16 34871572+gmackall@users.noreply.github.com Set an additional CMake arg in `forceNdkDownload` to make the task name align with the `BuildType` (flutter/flutter#167240)
2025-04-16 huy@nevercode.io Fix Carousel crashes when using PageStorageKey (flutter/flutter#166817)
2025-04-16 jason-simmons@users.noreply.github.com Revert "Removed superfluous copy in license checker (#167146)" (flutter/flutter#167246)
2025-04-16 dacoharkes@google.com [native assets] Roll dependencies (flutter/flutter#167287)
2025-04-16 fluttergithubbot@gmail.com Marks Linux_pixel_7pro static_path_stroke_tessellation_perf__timeline_summary to be unflaky (flutter/flutter#167259)
2025-04-16 34465683+rkishan516@users.noreply.github.com Feat: Add carousel view theme (flutter/flutter#164769)
2025-04-16 fluttergithubbot@gmail.com Marks Mac_ios dynamic_path_stroke_tessellation_perf_ios__timeline_summary to be unflaky (flutter/flutter#167261)
2025-04-16 jason-simmons@users.noreply.github.com When using --local-web-sdk, use a locally built Dart SDK if one is available (flutter/flutter#166732)
2025-04-16 30870216+gaaclarke@users.noreply.github.com Added emulator version to doctor (flutter/flutter#167236)
2025-04-16 fluttergithubbot@gmail.com Marks Mac_ios static_path_stroke_tessellation_perf_ios__timeline_summary to be unflaky (flutter/flutter#167260)
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 stuartmorgan@google.com,tarrinneal@google.com 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
Ortes pushed a commit to Ortes/packages that referenced this pull request Jun 25, 2025
flutter/flutter@aef4718...ecabb1a
2025-04-17 15619084+vashworth@users.noreply.github.com Hide error on mDNS registration failure and print warning in flutter attach (flutter/flutter#166782)
2025-04-17 bruno.leroux@gmail.com Add support for language hints in TextFields (Android only) (flutter/flutter#165554)
2025-04-17 engine-flutter-autoroll@skia.org Roll Skia from d8f13372549d to cc2b57434651 (1 revision) (flutter/flutter#167331)
2025-04-17 bruno.leroux@gmail.com Add DropdownMenu.restorationId (flutter/flutter#166684)
2025-04-17 engine-flutter-autoroll@skia.org Roll Skia from 3d6165b70199 to d8f13372549d (14 revisions) (flutter/flutter#167325)
2025-04-17 stanleycocoa@gmail.com fix(CircularProgressIndicator.adaptive): strokeWidth default value (flutter/flutter#165370)
2025-04-17 ahmedelsaayid@gmail.com Remove unnecessary builder (flutter/flutter#166623)
2025-04-17 34871572+gmackall@users.noreply.github.com Add a `gradle_errors.dart`entry for missing NDK source.properties file (flutter/flutter#167320)
2025-04-17 engine-flutter-autoroll@skia.org Roll Skia from 6627deb65939 to 3d6165b70199 (1 revision) (flutter/flutter#167255)
2025-04-17 engine-flutter-autoroll@skia.org Manual roll Dart SDK from 87965ab4864e to 992221a362ec (35 revisions) (flutter/flutter#167243)
2025-04-16 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from 7bWzHwIPBTyU6R9nO... to m8Aln7fTF_8zy1V9N... (flutter/flutter#167312)
2025-04-16 15619084+vashworth@users.noreply.github.com Don't throw on error for mDNS when searching for Dart VML url on core devices (flutter/flutter#167135)
2025-04-16 34465683+rkishan516@users.noreply.github.com Fix: Localization for non zero time in 24 hours format (flutter/flutter#164885)
2025-04-16 30870216+gaaclarke@users.noreply.github.com Updated docstrings for TextureContents (flutter/flutter#167221)
2025-04-16 30870216+gaaclarke@users.noreply.github.com Broke cyclical dependency with dlpath and typographer. (flutter/flutter#167293)
2025-04-16 34871572+gmackall@users.noreply.github.com Set an additional CMake arg in `forceNdkDownload` to make the task name align with the `BuildType` (flutter/flutter#167240)
2025-04-16 huy@nevercode.io Fix Carousel crashes when using PageStorageKey (flutter/flutter#166817)
2025-04-16 jason-simmons@users.noreply.github.com Revert "Removed superfluous copy in license checker (#167146)" (flutter/flutter#167246)
2025-04-16 dacoharkes@google.com [native assets] Roll dependencies (flutter/flutter#167287)
2025-04-16 fluttergithubbot@gmail.com Marks Linux_pixel_7pro static_path_stroke_tessellation_perf__timeline_summary to be unflaky (flutter/flutter#167259)
2025-04-16 34465683+rkishan516@users.noreply.github.com Feat: Add carousel view theme (flutter/flutter#164769)
2025-04-16 fluttergithubbot@gmail.com Marks Mac_ios dynamic_path_stroke_tessellation_perf_ios__timeline_summary to be unflaky (flutter/flutter#167261)
2025-04-16 jason-simmons@users.noreply.github.com When using --local-web-sdk, use a locally built Dart SDK if one is available (flutter/flutter#166732)
2025-04-16 30870216+gaaclarke@users.noreply.github.com Added emulator version to doctor (flutter/flutter#167236)
2025-04-16 fluttergithubbot@gmail.com Marks Mac_ios static_path_stroke_tessellation_perf_ios__timeline_summary to be unflaky (flutter/flutter#167260)
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 stuartmorgan@google.com,tarrinneal@google.com 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
@martin-ideeri

Copy link
Copy Markdown

Has this been released ? I'm still experiencing this issue in flutter 3.32.7

@huycozy

Copy link
Copy Markdown
MemberAuthor

Has this been released ? I'm still experiencing this issue in flutter 3.32.7

This hasn't landed in 3.32.7 yet, see 2c516f2.

engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 14, 2025
romanejaquez pushed a commit to romanejaquez/flutter that referenced this pull request Aug 14, 2025
- Fixflutter#166067
- PageStorage is usually used to save and restore offset of scrollable
widget when the widget is recreated in practice. From the crash stack
trace in bug report, it happens when [oldViewportDimensions gets a null
value](https://github.com/flutter/flutter/blob/3fa9b387052363e413b906da08c1b1d2d4140dfb/packages/flutter/lib/src/material/carousel.dart#L1472-L1485).
Tracing it down, it’s due to [hasViewportDimension is
false](https://github.com/flutter/flutter/blob/3fa9b387052363e413b906da08c1b1d2d4140dfb/packages/flutter/lib/src/widgets/scroll_position.dart#L275).
There might be a very brief moment when the scroll metrics are being
reconstructed, and the viewport dimensions are not yet ready, which
triggers the crash. If a PageStorageKey is not specified, the scroll
position would be newly created fresh each time, avoiding this
restoration process and the associated null state.
- The fix is simply to not force casting `oldViewportDimensions!`,
instead, it falls back to `viewportDimension` which is non-null for
safety.
## 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].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel
on [Discord].
<!-- 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
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 16, 2025
creatorpiyush pushed a commit to creatorpiyush/packages that referenced this pull request Jun 10, 2026
flutter/flutter@aef4718...ecabb1a
2025-04-17 15619084+vashworth@users.noreply.github.com Hide error on mDNS registration failure and print warning in flutter attach (flutter/flutter#166782)
2025-04-17 bruno.leroux@gmail.com Add support for language hints in TextFields (Android only) (flutter/flutter#165554)
2025-04-17 engine-flutter-autoroll@skia.org Roll Skia from d8f13372549d to cc2b57434651 (1 revision) (flutter/flutter#167331)
2025-04-17 bruno.leroux@gmail.com Add DropdownMenu.restorationId (flutter/flutter#166684)
2025-04-17 engine-flutter-autoroll@skia.org Roll Skia from 3d6165b70199 to d8f13372549d (14 revisions) (flutter/flutter#167325)
2025-04-17 stanleycocoa@gmail.com fix(CircularProgressIndicator.adaptive): strokeWidth default value (flutter/flutter#165370)
2025-04-17 ahmedelsaayid@gmail.com Remove unnecessary builder (flutter/flutter#166623)
2025-04-17 34871572+gmackall@users.noreply.github.com Add a `gradle_errors.dart`entry for missing NDK source.properties file (flutter/flutter#167320)
2025-04-17 engine-flutter-autoroll@skia.org Roll Skia from 6627deb65939 to 3d6165b70199 (1 revision) (flutter/flutter#167255)
2025-04-17 engine-flutter-autoroll@skia.org Manual roll Dart SDK from 87965ab4864e to 992221a362ec (35 revisions) (flutter/flutter#167243)
2025-04-16 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from 7bWzHwIPBTyU6R9nO... to m8Aln7fTF_8zy1V9N... (flutter/flutter#167312)
2025-04-16 15619084+vashworth@users.noreply.github.com Don't throw on error for mDNS when searching for Dart VML url on core devices (flutter/flutter#167135)
2025-04-16 34465683+rkishan516@users.noreply.github.com Fix: Localization for non zero time in 24 hours format (flutter/flutter#164885)
2025-04-16 30870216+gaaclarke@users.noreply.github.com Updated docstrings for TextureContents (flutter/flutter#167221)
2025-04-16 30870216+gaaclarke@users.noreply.github.com Broke cyclical dependency with dlpath and typographer. (flutter/flutter#167293)
2025-04-16 34871572+gmackall@users.noreply.github.com Set an additional CMake arg in `forceNdkDownload` to make the task name align with the `BuildType` (flutter/flutter#167240)
2025-04-16 huy@nevercode.io Fix Carousel crashes when using PageStorageKey (flutter/flutter#166817)
2025-04-16 jason-simmons@users.noreply.github.com Revert "Removed superfluous copy in license checker (#167146)" (flutter/flutter#167246)
2025-04-16 dacoharkes@google.com [native assets] Roll dependencies (flutter/flutter#167287)
2025-04-16 fluttergithubbot@gmail.com Marks Linux_pixel_7pro static_path_stroke_tessellation_perf__timeline_summary to be unflaky (flutter/flutter#167259)
2025-04-16 34465683+rkishan516@users.noreply.github.com Feat: Add carousel view theme (flutter/flutter#164769)
2025-04-16 fluttergithubbot@gmail.com Marks Mac_ios dynamic_path_stroke_tessellation_perf_ios__timeline_summary to be unflaky (flutter/flutter#167261)
2025-04-16 jason-simmons@users.noreply.github.com When using --local-web-sdk, use a locally built Dart SDK if one is available (flutter/flutter#166732)
2025-04-16 30870216+gaaclarke@users.noreply.github.com Added emulator version to doctor (flutter/flutter#167236)
2025-04-16 fluttergithubbot@gmail.com Marks Mac_ios static_path_stroke_tessellation_perf_ios__timeline_summary to be unflaky (flutter/flutter#167260)
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 stuartmorgan@google.com,tarrinneal@google.com 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
bisor0627 pushed a commit to bisor0627/packages that referenced this pull request Jun 19, 2026
flutter/flutter@aef4718...ecabb1a
2025-04-17 15619084+vashworth@users.noreply.github.com Hide error on mDNS registration failure and print warning in flutter attach (flutter/flutter#166782)
2025-04-17 bruno.leroux@gmail.com Add support for language hints in TextFields (Android only) (flutter/flutter#165554)
2025-04-17 engine-flutter-autoroll@skia.org Roll Skia from d8f13372549d to cc2b57434651 (1 revision) (flutter/flutter#167331)
2025-04-17 bruno.leroux@gmail.com Add DropdownMenu.restorationId (flutter/flutter#166684)
2025-04-17 engine-flutter-autoroll@skia.org Roll Skia from 3d6165b70199 to d8f13372549d (14 revisions) (flutter/flutter#167325)
2025-04-17 stanleycocoa@gmail.com fix(CircularProgressIndicator.adaptive): strokeWidth default value (flutter/flutter#165370)
2025-04-17 ahmedelsaayid@gmail.com Remove unnecessary builder (flutter/flutter#166623)
2025-04-17 34871572+gmackall@users.noreply.github.com Add a `gradle_errors.dart`entry for missing NDK source.properties file (flutter/flutter#167320)
2025-04-17 engine-flutter-autoroll@skia.org Roll Skia from 6627deb65939 to 3d6165b70199 (1 revision) (flutter/flutter#167255)
2025-04-17 engine-flutter-autoroll@skia.org Manual roll Dart SDK from 87965ab4864e to 992221a362ec (35 revisions) (flutter/flutter#167243)
2025-04-16 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from 7bWzHwIPBTyU6R9nO... to m8Aln7fTF_8zy1V9N... (flutter/flutter#167312)
2025-04-16 15619084+vashworth@users.noreply.github.com Don't throw on error for mDNS when searching for Dart VML url on core devices (flutter/flutter#167135)
2025-04-16 34465683+rkishan516@users.noreply.github.com Fix: Localization for non zero time in 24 hours format (flutter/flutter#164885)
2025-04-16 30870216+gaaclarke@users.noreply.github.com Updated docstrings for TextureContents (flutter/flutter#167221)
2025-04-16 30870216+gaaclarke@users.noreply.github.com Broke cyclical dependency with dlpath and typographer. (flutter/flutter#167293)
2025-04-16 34871572+gmackall@users.noreply.github.com Set an additional CMake arg in `forceNdkDownload` to make the task name align with the `BuildType` (flutter/flutter#167240)
2025-04-16 huy@nevercode.io Fix Carousel crashes when using PageStorageKey (flutter/flutter#166817)
2025-04-16 jason-simmons@users.noreply.github.com Revert "Removed superfluous copy in license checker (#167146)" (flutter/flutter#167246)
2025-04-16 dacoharkes@google.com [native assets] Roll dependencies (flutter/flutter#167287)
2025-04-16 fluttergithubbot@gmail.com Marks Linux_pixel_7pro static_path_stroke_tessellation_perf__timeline_summary to be unflaky (flutter/flutter#167259)
2025-04-16 34465683+rkishan516@users.noreply.github.com Feat: Add carousel view theme (flutter/flutter#164769)
2025-04-16 fluttergithubbot@gmail.com Marks Mac_ios dynamic_path_stroke_tessellation_perf_ios__timeline_summary to be unflaky (flutter/flutter#167261)
2025-04-16 jason-simmons@users.noreply.github.com When using --local-web-sdk, use a locally built Dart SDK if one is available (flutter/flutter#166732)
2025-04-16 30870216+gaaclarke@users.noreply.github.com Added emulator version to doctor (flutter/flutter#167236)
2025-04-16 fluttergithubbot@gmail.com Marks Mac_ios static_path_stroke_tessellation_perf_ios__timeline_summary to be unflaky (flutter/flutter#167260)
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 stuartmorgan@google.com,tarrinneal@google.com 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
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frameworkflutter/packages/flutter repository. See also f: labels.p: material_uimaterial_ui package in flutter/packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CarouselView: using PageStorageKey throws Null check operator used on a null value

3 participants

@huycozy@martin-ideeri@QuncCccccc