Skip to content

scrollToIndex throwing an exception for very small scroll durations #83

@D-Raiser

Description

@D-Raiser

When passing a duration to scrollToIndex that is smaller than 40µs (basically using it as a jumpTo with index), the call throws the following exception:

I/flutter ( 3806): 'package:flutter/src/widgets/scroll_activity.dart': Failed assertion: line 623 pos 15: 'duration > Duration.zero': is not true.
I/flutter ( 3806): #0      _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:46:39)
I/flutter ( 3806): #1      _AssertionError._throwNew (dart:core-patch/errors_patch.dart:36:5)
I/flutter ( 3806): #2      new DrivenScrollActivity (package:flutter/src/widgets/scroll_activity.dart:623:15)
I/flutter ( 3806): #3      ScrollPositionWithSingleContext.animateTo (package:flutter/src/widgets/scroll_position_with_single_context.dart:181:43)
I/flutter ( 3806): #4      ScrollController.animateTo (package:flutter/src/widgets/scroll_controller.dart:154:68)
I/flutter ( 3806): #5      AutoScrollControllerMixin._scrollToIndex (package:scroll_to_index/scroll_to_index.dart:285:15)

It seems that this happens because the duration passed as a parameter is divided by 40 and the result is then used as the actual duration but there is no documentation why (or whether) this division is necessary

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions