Skip to content

Adds migration guide for default cache extent change#13177

Draft
chunhtai wants to merge 1 commit intoflutter:mainfrom
chunhtai:cache-default
Draft

Adds migration guide for default cache extent change#13177
chunhtai wants to merge 1 commit intoflutter:mainfrom
chunhtai:cache-default

Conversation

@chunhtai
Copy link
Copy Markdown
Contributor

for flutter/flutter#182905

Presubmit checklist

  • If you are unwilling, or unable, to sign the CLA, even for a tiny, one-word PR, please file an issue instead of a PR.
  • If this PR is not meant to land until a future stable release, mark it as draft with an explanation.
  • This PR follows the Google Developer Documentation Style Guidelines—for example, it doesn't use i.e. or e.g., and it avoids I and we (first-person pronouns).
  • This PR uses semantic line breaks
    of 80 characters or fewer.

@chunhtai chunhtai changed the title Adds migration guide for default cache extent changed Adds migration guide for default cache extent change Mar 13, 2026
@flutter-website-bot
Copy link
Copy Markdown
Collaborator

Visit the preview URL for this PR (updated for commit b3d0916):

https://flutter-docs-prod--pr13177-cache-default-th9gvcrr.web.app

Copy link
Copy Markdown
Contributor

@sfshaza2 sfshaza2 left a comment

Choose a reason for hiding this comment

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

I know that this is still in draft form, but lgtm, so it's ready when you are.

@chunhtai chunhtai marked this pull request as ready for review May 1, 2026 17:49
@chunhtai chunhtai requested a review from a team as a code owner May 1, 2026 17:49
@chunhtai chunhtai marked this pull request as draft May 1, 2026 17:50
@chunhtai
Copy link
Copy Markdown
Contributor Author

chunhtai commented May 1, 2026

update: still migrating internal tests and the pr is under code freeze

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces documentation for a breaking change where the default cacheExtent for scrolling widgets is updated from a fixed 250 pixels to 0.8 times the viewport size. The review feedback focuses on ensuring the documentation adheres to the project's style guide by implementing semantic line breaks and maintaining a maximum line length of 80 characters. Additionally, there is a suggestion to explicitly include ScrollView in the list of affected widgets.


## Summary

The default cache extent for scrolling widgets (`ListView`, `GridView`, `CustomScrollView`, and `Scrollable`) changed from a fixed value of `250.0` pixels to `0.8` times the viewport's dimension along the main axis.
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.

medium

This line exceeds 80 characters and does not use semantic line breaks as required by the project's style guide. Additionally, consider adding ScrollView to the list of widgets, as it is the base class that defines the property.

Suggested change
The default cache extent for scrolling widgets (`ListView`, `GridView`, `CustomScrollView`, and `Scrollable`) changed from a fixed value of `250.0` pixels to `0.8` times the viewport's dimension along the main axis.
The default cache extent for scrolling widgets
(`ScrollView`, `ListView`, `GridView`, `CustomScrollView`, and `Scrollable`)
changed from a fixed value of `250.0` pixels
to `0.8` times the viewport's dimension along the main axis.
References
  1. The project requires semantic line breaks of 80 characters or fewer for documentation. (link)

Comment on lines +15 to +17
Previously, the default cache extent was `250.0` pixels. A fixed pixel cache extent is too small on large monitors and unnecessarily large on very small screens. Furthermore, the fixed 250-pixel cache extent can be too small to accommodate accessibility scrolling, which is based on the viewport size. This sometimes causes iOS VoiceOver to lose its current focus because the currently focused item scrolls outside of the cache extent.

The new default cache extent is `0.8` times the viewport extent. The cache region extends 80% of the viewport's main axis dimension both before and after the visible area. This preloads an appropriate amount of content for any screen size.
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.

medium

These lines exceed 80 characters and should use semantic line breaks to improve readability and diffing, as specified in the PR checklist.

Suggested change
Previously, the default cache extent was `250.0` pixels. A fixed pixel cache extent is too small on large monitors and unnecessarily large on very small screens. Furthermore, the fixed 250-pixel cache extent can be too small to accommodate accessibility scrolling, which is based on the viewport size. This sometimes causes iOS VoiceOver to lose its current focus because the currently focused item scrolls outside of the cache extent.
The new default cache extent is `0.8` times the viewport extent. The cache region extends 80% of the viewport's main axis dimension both before and after the visible area. This preloads an appropriate amount of content for any screen size.
Previously, the default cache extent was `250.0` pixels.
A fixed pixel cache extent is too small on large monitors
and unnecessarily large on very small screens.
Furthermore, the fixed 250-pixel cache extent can be too small
to accommodate accessibility scrolling, which is based on the viewport size.
This sometimes causes iOS VoiceOver to lose its current focus
because the currently focused item scrolls outside of the cache extent.
The new default cache extent is `0.8` times the viewport extent.
The cache region extends 80% of the viewport's main axis dimension
both before and after the visible area.
This preloads an appropriate amount of content for any screen size.
References
  1. The project requires semantic line breaks of 80 characters or fewer for documentation. (link)


## Description of change

Any scrolling widget that relies on the default cache extent will now have a cache extent relative to its viewport size instead of a fixed `250.0` pixels.
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.

medium

This line exceeds 80 characters. Please use semantic line breaks.

Suggested change
Any scrolling widget that relies on the default cache extent will now have a cache extent relative to its viewport size instead of a fixed `250.0` pixels.
Any scrolling widget that relies on the default cache extent
will now have a cache extent relative to its viewport size
instead of a fixed `250.0` pixels.
References
  1. The project requires semantic line breaks of 80 characters or fewer for documentation. (link)

For example, on a device with a scroll view height of 1000 pixels:

* Old behavior: The cache area is 250 pixels above and below the visible area.
* New behavior: The cache area is `1000 * 0.8 = 800` pixels above and below the visible area.
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.

medium

This line exceeds 80 characters. Please use semantic line breaks.

Suggested change
* New behavior: The cache area is `1000 * 0.8 = 800` pixels above and below the visible area.
* New behavior: The cache area is `1000 * 0.8 = 800` pixels
above and below the visible area.
References
  1. The project requires semantic line breaks of 80 characters or fewer for documentation. (link)

* Old behavior: The cache area is 250 pixels above and below the visible area.
* New behavior: The cache area is `1000 * 0.8 = 800` pixels above and below the visible area.

This change does not affect widgets where the cache extent is explicitly provided (such as `ListView(cacheExtent: 500)` or `ListView(scrollCacheExtent: ScrollCacheExtent.pixels(500))`).
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.

medium

This line exceeds 80 characters. Please use semantic line breaks.

Suggested change
This change does not affect widgets where the cache extent is explicitly provided (such as `ListView(cacheExtent: 500)` or `ListView(scrollCacheExtent: ScrollCacheExtent.pixels(500))`).
This change does not affect widgets where the cache extent is explicitly
provided (such as `ListView(cacheExtent: 500)` or
`ListView(scrollCacheExtent: ScrollCacheExtent.pixels(500))`).
References
  1. The project requires semantic line breaks of 80 characters or fewer for documentation. (link)


## Migration guide

Most applications do not require modifications. If your application relies on the 250-pixel default, you can restore the previous behavior by explicitly setting the cache extent property.
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.

medium

This line exceeds 80 characters. Please use semantic line breaks.

Suggested change
Most applications do not require modifications. If your application relies on the 250-pixel default, you can restore the previous behavior by explicitly setting the cache extent property.
Most applications do not require modifications.
If your application relies on the 250-pixel default,
you can restore the previous behavior by explicitly setting
the cache extent property.
References
  1. The project requires semantic line breaks of 80 characters or fewer for documentation. (link)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants