Skip to content

ScrollCacheExtent is not publicly exported, cacheExtent migration does not work #189347

Closed

Description

@MustafaAdam

Steps to reproduce

  1. In your project, upgrade flutter to 3.44.6
  2. you receive an error that ListView.cacheExtent is deprecated and you can't use int or double.
  3. 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.

Activity

  1. AbdeMohlbi commented on Jul 12, 2026

    @AbdeMohlbi
    Member

    not sure if this is an issue with the fix or not but here is more info and a workaround
    first a repro

    Image

    this will trigger:

    Image

    after the fix is applied (or doing the manual fix) you will get:

    Image

    the issue here is that ScrollCacheExtent needs the import '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 .pixels it works because of the dot shorthand feature, still i think the docs should mention that you may need to add import 'package:flutter/rendering.dart since you will need it unless you already have it or use the .pixels

  2. FMorschel commented on Jul 12, 2026

    @FMorschel
    Contributor

    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.

  3. MustafaAdam commented on Jul 12, 2026

    @MustafaAdam
    Author

    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.

  4. puneetkukreja98 commented on Jul 13, 2026

    @puneetkukreja98
    Contributor

    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.

    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:

    1. Manually add the import: import 'package:flutter/rendering.dart';
    2. Use the Dart constructor shorthand feature: 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 (Channel stable, 3.44.6, on macOS 26.4.1 25E253 darwin-arm64, locale en-US) [785ms]
        • Flutter version 3.44.6 on channel stable at /Users/puneetkukreja/Developer/flutter
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision ee80f08bbf (5 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, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-native-assets, no-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) [2.5s]
        • Android SDK at /Users/puneetkukreja/Library/Android/sdk
        • Emulator version 36.5.10.0 (build_id 15081367) (CL:N/A)
        • Platform android-36.1, build-tools 36.1.0
        • Java binary at: /Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home/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 Java(TM) SE Runtime Environment (build 17.0.12+8-LTS-286)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 26.6) [1,527ms]
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Build 17F113
        • CocoaPods version 1.16.2
    
    [✓] Chrome - develop for the web [9ms]
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Connected device (3 available) [7.7s]
        • Puneet’s iPhone (wireless) (mobile) • 00008110-00167CEE0C46401E • ios            • iOS 18.0.1 22A3370
        • macOS (desktop)                     • macos                     • darwin-arm64   • macOS 26.4.1 25E253 darwin-arm64
        • Chrome (web)                        • chrome                    • web-javascript • Google Chrome 149.0.7827.199
    
    [✓] Network resources [991ms]
        • All expected network resources are available.
    
    • No issues found!
    
  5. added
    d: api docsIssues with https://api.flutter.dev/
    frameworkflutter/packages/flutter repository. See also f: labels.
    and removed
    in triagePresently being triaged by the triage team
    on Jul 13, 2026
  6. flutter-triage-bot commented on Jul 14, 2026

    @flutter-triage-bot

    This issue is missing a priority label. Please set a priority label when adding the triaged-framework label.

  7. added
    P3Issues that are less important to the Flutter project
    on Jul 14, 2026
  8. justinmc commented on Jul 14, 2026

    @justinmc
    Contributor

    CC @chunhtai, do you have any opinions on this?

  9. self-assigned this
    on Jul 14, 2026
  10. bwilkerson commented on Jul 14, 2026

    @bwilkerson
    Contributor

    I suspect that if that is supported, the information should've been given by the fix_data author and may be missing.

    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.

  11. chunhtai commented on Jul 15, 2026

    @chunhtai
    Contributor

    looks like i forgot to re-export it in widget layer. we should definitely fix it

  12. github-actions commented on Aug 4, 2026

    @github-actions

    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 -v and a minimal reproduction of the issue.

  13. locked as resolved and limited conversation to collaborators on Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P3Issues that are less important to the Flutter projectd: api docsIssues with https://api.flutter.dev/frameworkflutter/packages/flutter repository. See also f: labels.team-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework teamworkaround availableThere is a workaround available to overcome the issue

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions