Dimibe / sticky_grouped_list

A ScrollablePositionedList in which items can be grouped into sections with sticky headers.
https://pub.dev/packages/sticky_grouped_list
MIT License
170 stars 66 forks source link

Exception when list is on scroll more and new items(chats) are added to stream. #25

Open ericel opened 3 years ago

ericel commented 3 years ago

I get the following exception when list is in load more and chat items are added to scream.

══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
The following RangeError was thrown building StreamBuilder<int>(dirty, state:
_StreamBuilderBaseState<int, AsyncSnapshot<int>>#1312e):
RangeError (index): Invalid value: Not in inclusive range 0..19: 59
The relevant error-causing widget was:

package:app/…/state_widgets/chat_home_widget.dart:182
When the exception was thrown, this was the stack:
#0      List.[] (dart:core-patch/growable_array.dart:166:60)
#1      _StickyGroupedListViewState._showFixedGroupHeader
package:sticky_grouped_list/sticky_grouped_list.dart:324
#2      _StickyGroupedListViewState.build.<anonymous closure>
package:sticky_grouped_list/sticky_grouped_list.dart:24

I checked this behavior with native listview.builder but didn't get any such error.

But sticky_group_list causes this exception.

maulik-benzatine commented 1 year ago

I'm facing the same issue, any update on this?

https://user-images.githubusercontent.com/62459896/229017266-2db96a54-e06b-4058-97b1-8419e3b33313.mp4

======== Exception caught by foundation library ==================================================== The following RangeError was thrown while dispatching notifications for ValueNotifier<Iterable>: RangeError (index): Invalid value: Not in inclusive range 0..9: 28

When the exception was thrown, this was the stack:

0 List.[] (dart:core-patch/growable_array.dart:264:36)

1 StickyGroupedListViewState._positionListener (package:sticky_grouped_list/src/sticky_grouped_list.dart:321:45)

2 ChangeNotifier.notifyListeners (package:flutter/src/foundation/change_notifier.dart:381:24)

3 ValueNotifier.value= (package:flutter/src/foundation/change_notifier.dart:495:5)

4 _ScrollablePositionedListState._updatePositions (package:scrollable_positioned_list/src/scrollable_positioned_list.dart:578:49)

5 ChangeNotifier.notifyListeners (package:flutter/src/foundation/change_notifier.dart:381:24)

6 ValueNotifier.value= (package:flutter/src/foundation/change_notifier.dart:495:5)

7 _PositionedListState._schedulePositionNotificationUpdate. (package:scrollable_positioned_list/src/positioned_list.dart:364:53)

tinkie101 commented 4 months ago

Also running into this issue. A fix would be very much appreciated.