Repository navigation
ScrollCacheExtent is not publicly exported, cacheExtent migration does not work #189347
Copy link
Copy link
Closed
Closed
Copy link
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projectd: api docsIssues with https://api.flutter.dev/Issues with https://api.flutter.dev/frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.team-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework teamworkaround availableThere is a workaround available to overcome the issueThere is a workaround available to overcome the issue
Description
Steps to reproduce
- In your project, upgrade flutter to 3.44.6
- you receive an error that
ListView.cacheExtentis deprecated and you can't use int or double. - documentation says we should use
scrollCacheExtent
Expected results
As per the documentation, this is supposed to work without issue.
Unless this documentation page is stale as per the warning on the page:
"
Important
These breaking change docs are accurate, as of the release under which they are published.
Over time, the workarounds described here might become inaccurate.
We don't, in general, keep these breaking change docs up to date as of each release.
"
Actual results
When I did the migration step in the documentation, and changed it to scrollCacheExtent: const ScrollCacheExtent.pixels(2000), I got an error Undefined name 'ScrollCacheExtent'.
Code sample
Code sample
It only worked when i did the following:
replaced this:
scrollCacheExtent: const ScrollCacheExtent.pixels(2000),with
scrollCacheExtent: const .pixels(1600),Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
[Paste your logs here]Flutter Doctor output
Doctor output
[✓] Flutter (Channel stable, 3.44.6, on Ubuntu 24.04.4 LTS 6.17.0-35-generic, locale en_US.UTF-8) [36ms]
• Flutter version 3.44.6 on channel stable at /home/*****/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision ee80f08bbf (4 days ago), 2026-07-08 15:02:06 -0700
• Engine revision 83675ed276
• Dart version 3.12.2
• DevTools version 2.57.0
• Feature flags: enable-web, no-enable-linux-desktop, no-enable-macos-desktop, no-enable-windows-desktop,
enable-android, no-enable-ios, cli-animations, enable-native-assets, enable-swift-package-manager,
omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration
[✓] Android toolchain - develop for Android devices (Android SDK version 36.1.0) [1,945ms]
• Android SDK at /home/*****/Android/Sdk
• Emulator version 36.4.9.0 (build_id 14788078) (CL:N/A)
• Platform android-37.0, build-tools 36.1.0
• ANDROID_HOME = /home/*****/Android/Sdk
• ANDROID_SDK_ROOT = /home/*****/Android/Sdk
• Java binary at: /usr/lib/jvm/java-17-openjdk-amd64/bin/java
This JDK is specified in your Flutter configuration.
To change the current JDK, run: `flutter config --jdk-dir="path/to/jdk"`.
• Java version OpenJDK Runtime Environment (build 17.0.19+10-1-24.04.2-Ubuntu)
• All Android licenses accepted.
[✓] Connected device (2 available)
• Android device • android-arm64 • Android 14 (API 34)
• Chrome • web-javascript • Google Chrome 150.0.7871.46
[✓] Network resources
• All expected network resources are available.Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projectd: api docsIssues with https://api.flutter.dev/Issues with https://api.flutter.dev/frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.team-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework teamworkaround availableThere is a workaround available to overcome the issueThere is a workaround available to overcome the issue
Activity
AbdeMohlbi commentedon Jul 12, 2026
not sure if this is an issue with the fix or not but here is more info and a workaround
first a repro
this will trigger:
after the fix is applied (or doing the manual fix) you will get:
the issue here is that
ScrollCacheExtentneeds theimport 'package:flutter/rendering.dart';import to work, not sure if any migrations like that usually adds the missing imports@FMorschel is the fix supposed to add the missing imports on it's own?
for the
.pixelsit works because of the dot shorthand feature, still i think the docs should mention that you may need to addimport 'package:flutter/rendering.dartsince you will need it unless you already have it or use the.pixelsFMorschel commentedon Jul 12, 2026
I'm not familiar with data fixes, but @srawlins and @bwilkerson likely know that information.
I suspect that if that is supported, the information should've been given by the fix_data author and may be missing.
MustafaAdam commentedon Jul 12, 2026
A note here @AbdeMohlbi. Importing rendering package did not actually work for me. I tried that too.
If it is the solution, then the current page (which is the first Google result) is missing crucial info here.
puneetkukreja98 commentedon Jul 13, 2026
I was able to reproduce the issue locally, and importing the rendering package works on my end (attaching the video for reference).
For now, there are two available workarounds:
import 'package:flutter/rendering.dart';scrollCacheExtent: const .pixels(1600),This appears to be a documentation issue rather than a framework bug.
Video:
import_issue_list_view.mov
Flutter doctor -v:
flutter-triage-bot commentedon Jul 14, 2026
This issue is missing a priority label. Please set a priority label when adding the
triaged-frameworklabel.justinmc commentedon Jul 14, 2026
CC @chunhtai, do you have any opinions on this?
bwilkerson commentedon Jul 14, 2026
I don't know whether adding an import is currently supported for the change being used here (and I don't know what change is being used), but if not then it's likely that it could be supported. Most of the changes allow the library to be included, and it would be good if all of them did.
Unfortunately, support can't be added retroactively, so we might not be able to do anything about this transform. That doesn't mean that we shouldn't make it available for the next similar transform.
chunhtai commentedon Jul 15, 2026
looks like i forgot to re-export it in widget layer. we should definitely fix it
widgets layer re-export ScrollCacheExtent (flutter#189483)
github-actions commentedon Aug 4, 2026
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.