MarcinusX / NumberPicker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Get an error on popping view while picker is scrolling.

mitulvaghamshi opened this issue · comments

E/flutter ( 4433): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: 'package:flutter/src/widgets/scroll_controller.dart': Failed assertion: line 108 pos 12: '_positions.isNotEmpty': ScrollController not attached to any scroll views.
E/flutter ( 4433): #0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:46:39)
E/flutter ( 4433): #1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:36:5)
E/flutter ( 4433): #2 ScrollController.position (package:flutter/src/widgets/scroll_controller.dart:108:12)
E/flutter ( 4433): #3 _NumberPickerState.isScrolling (package:numberpicker/src/numberpicker.dart:125:45)
E/flutter ( 4433): #4 _NumberPickerState._maybeCenterValue (package:numberpicker/src/numberpicker.dart:213:10)
E/flutter ( 4433): #5 _NumberPickerState._scrollListener. (package:numberpicker/src/numberpicker.dart:107:13)
E/flutter ( 4433): #6 new Future.delayed. (dart:async/future.dart:315:39)
E/flutter ( 4433): #7 _rootRun (dart:async/zone.dart:1346:47)
E/flutter ( 4433): #8 _CustomZone.run (dart:async/zone.dart:1258:19)
E/flutter ( 4433): #9 _CustomZone.runGuarded (dart:async/zone.dart:1162:7)
E/flutter ( 4433): #10 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:1202:23)
E/flutter ( 4433): #11 _rootRun (dart:async/zone.dart:1354:13)
E/flutter ( 4433): #12 _CustomZone.run (dart:async/zone.dart:1258:19)
E/flutter ( 4433): #13 _CustomZone.bindCallback. (dart:async/zone.dart:1186:23)
E/flutter ( 4433): #14 Timer._createTimer. (dart:async-patch/timer_patch.dart:18:15)
E/flutter ( 4433): #15 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:395:19)
E/flutter ( 4433): #16 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:426:5)
E/flutter ( 4433): #17 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)
E/flutter ( 4433):
E/flutter ( 4433): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: 'package:flutter/src/widgets/scroll_controller.dart': Failed assertion: line 108 pos 12: '_positions.isNotEmpty': ScrollController not attached to any scroll views.
E/flutter ( 4433): #0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:46:39)
E/flutter ( 4433): #1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:36:5)
E/flutter ( 4433): #2 ScrollController.position (package:flutter/src/widgets/scroll_controller.dart:108:12)
E/flutter ( 4433): #3 _NumberPickerState.isScrolling (package:numberpicker/src/numberpicker.dart:125:45)
E/flutter ( 4433): #4 _NumberPickerState._maybeCenterValue (package:numberpicker/src/numberpicker.dart:213:10)
E/flutter ( 4433): #5 _NumberPickerState._scrollListener. (package:numberpicker/src/numberpicker.dart:107:13)
E/flutter ( 4433): #6 new Future.delayed. (dart:async/future.dart:315:39)
E/flutter ( 4433): #7 _rootRun (dart:async/zone.dart:1346:47)
E/flutter ( 4433): #8 _CustomZone.run (dart:async/zone.dart:1258:19)
E/flutter ( 4433): #9 _CustomZone.runGuarded (dart:async/zone.dart:1162:7)
E/flutter ( 4433): #10 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:1202:23)
E/flutter ( 4433): #11 _rootRun (dart:async/zone.dart:1354:13)
E/flutter ( 4433): #12 _CustomZone.run (dart:async/zone.dart:1258:19)
E/flutter ( 4433): #13 _CustomZone.bindCallback. (dart:async/zone.dart:1186:23)
E/flutter ( 4433): #14 Timer._createTimer. (dart:async-patch/timer_patch.dart:18:15)
E/flutter ( 4433): #15 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:395:19)
E/flutter ( 4433): #16 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:426:5)
E/flutter ( 4433): #17 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)
E/flutter ( 4433):

Not sure whether you understand my words.
But, when I scroll the list in picker at very fast speed (generally we do on very long lists to reach desired element) and at the same time I hit back button (Navigator.pop()) when list is scrolling, will generate this error, though app execution does not affected by this.

Experiencing something similar. My use case is when a parent widget is disposed of whilst the number picker is still scrolling. All visuals behave as expected, but this error is thrown.

E/flutter (12427): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: 'package:flutter/src/widgets/scroll_controller.dart': Failed assertion: line 108 pos 12: '_positions.isNotEmpty': ScrollController not attached to any scroll views.
E/flutter (12427): #0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:46:39)
E/flutter (12427): #1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:36:5)
E/flutter (12427): #2 ScrollController.position
package:flutter/…/widgets/scroll_controller.dart:108
E/flutter (12427): #3 _NumberPickerState.isScrolling
package:numberpicker/src/numberpicker.dart:125
E/flutter (12427): #4 _NumberPickerState._maybeCenterValue
package:numberpicker/src/numberpicker.dart:213
E/flutter (12427): #5 _NumberPickerState._scrollListener.
package:numberpicker/src/numberpicker.dart:107
E/flutter (12427): #6 new Future.delayed. (dart:async/future.dart:315:39)
E/flutter (12427): #7 _rootRun (dart:async/zone.dart:1346:47)
E/flutter (12427): #8 _CustomZone.run (dart:async/zone.dart:1258:19)
E/flutter (12427): #9 _CustomZone.runGuarded (dart:async/zone.dart:1162:7)
E/flutter (12427): #10 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:1202:23)
E/flutter (12427): #11 _rootRun (dart:async/zone.dart:1354:13)
E/flutter (12427): #12 _CustomZone.run (dart:async/zone.dart:1258:19)
E/flutter (12427): #13 _CustomZone.bindCallback. (dart:async/zone.dart:1186:23)
E/flutter (12427): #14 Timer._createTimer. (dart:async-patch/timer_patch.dart:18:15)
E/flutter (12427): #15 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:395:19)
E/flutter (12427): #16 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:426:5)
E/flutter (12427): #17 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)

I'll look into it

Just published version 2.0.1, can you confirm it's fixed there? Thanks :)

Yeah! it's good now. works without producing any error.
Thanks for the fix.