ItemScrollController.scrollTo() accepts a negative index input, which then gets passed over to the ItemBuilder function inside ScrollablePositionList, thus breaking the preconditions set by that function:
"Called to build children for the list with 0 <= index < itemCount".
Steps to reproduce
The following widget will showcase the behavior succinctly :
ItemScrollController.scrollTo() should validate the index it is given and throw immediately if the value is negative.
Actual behavior
The negative index is propagated to the item builder function inside the ScrollablePositionedList, causing any stacktraces raised to point incorrectly to a different call-site as the culprit, rather than any call-site where ItemScrollController.scrollTo() is invoked.
Problem description
ItemScrollController.scrollTo()
accepts a negative index input, which then gets passed over to the ItemBuilder function insideScrollablePositionList
, thus breaking the preconditions set by that function:"Called to build children for the list with 0 <= index < itemCount".
Steps to reproduce
The following widget will showcase the behavior succinctly :
Expected behavior
ItemScrollController.scrollTo()
should validate the index it is given and throw immediately if the value is negative.Actual behavior
The negative index is propagated to the item builder function inside the
ScrollablePositionedList
, causing any stacktraces raised to point incorrectly to a different call-site as the culprit, rather than any call-site whereItemScrollController.scrollTo()
is invoked.Environment
dart: 3.1.0 flutter: 3.13.2 scrollable_positioned_list: 0.3.8
Additional details