Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

fixes DrivenScrollActivity LateInitializationError _controller #170047

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
Loading
from

Conversation

agrapine
Copy link

@agrapine agrapine commented Jun 5, 2025

When we call ScrollController.animateTo(someOffset, duration: Duration.zero) we can end up with an animation tick being handled before the _controller in DrivenScrollActivity is initialised.
Current workaround is to guard against such case, but once in production is basically broken :(

Error:

LateError: LateInitializationError: Field '_controller@375498029' has not been initialized.
#0      DrivenScrollActivity._tick (package:flutter/src/widgets/scroll_activity.dart)
#1      AnimationLocalListenersMixin.notifyListeners (package:flutter/src/animation/listener_helpers.dart:161)
#2      AnimationController._animateToInternal (package:flutter/src/animation/animation_controller.dart:694)
#3      AnimationController.animateTo (package:flutter/src/animation/animation_controller.dart:617)
#4      new DrivenScrollActivity (package:flutter/src/widgets/scroll_activity.dart:718)
#5      ScrollPositionWithSingleContext.animateTo (package:flutter/src/widgets/scroll_position_with_single_context.dart:184)
#6      ScrollController.animateTo (package:flutter/src/widgets/scroll_controller.dart:214)

List which issues are fixed by this PR. You must list at least one issue. An issue is not required if the PR fixes something trivial like a typo.

If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.

Pre-launch Checklist

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

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

Copy link

google-cla bot commented Jun 5, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: scrolling Viewports, list views, slivers, etc. labels Jun 5, 2025
@agrapine agrapine force-pushed the fix/scrollactivity_uninitialized_field branch from c83a088 to d4e64d8 Compare June 5, 2025 06:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
f: scrolling Viewports, list views, slivers, etc. framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
Morty Proxy This is a proxified and sanitized view of the page, visit original site.