Skip to content
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

Flutter 2.8.1 - ScrollController not attached to any scroll views error #76

Closed
aytunch opened this issue Jan 22, 2022 · 4 comments
Closed

Comments

@aytunch
Copy link

aytunch commented Jan 22, 2022

[VERBOSE-2:ui_dart_state.cc(209)] Unhandled Exception: 'package:flutter/src/widgets/scroll_controller.dart': Failed assertion: line 170 pos 12: '_positions.isNotEmpty': ScrollController not attached to any scroll views.
#0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:47:61)
#1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:36:5)
#2 ScrollController.jumpTo
package:flutter/…/widgets/scroll_controller.dart:170
#3 _MarqueeState.initState.
package:marquee/marquee.dart:548
#4 _MarqueeState.initState.
package:marquee/marquee.dart:545
#5 SchedulerBinding._invokeFrameCallback
package:flutter/…/scheduler/binding.dart:1145

@danielkohl
Copy link

+1

@SergeyShustikov
Copy link

SergeyShustikov commented Feb 11, 2022

Fixed by rewrtining initState method

 WidgetsBinding.instance?.addPostFrameCallback((_) async {
      if (!_running) {
        _running = true;
        if (_controller.hasClients) {
          _controller.jumpTo(_startPosition);
          await Future<void>.delayed(widget.startAfter);
          Future.doWhile(_scroll);
        }
      }
    });

@aytunch
Copy link
Author

aytunch commented Feb 11, 2022

@SergeyShustikov @MarcelGarus Can we merge this fix to the package?

@MarcelGarus
Copy link
Owner

I merged this; it's published in version 2.2.1.

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

No branches or pull requests

4 participants