flutter_elastic_list_view icon indicating copy to clipboard operation
flutter_elastic_list_view copied to clipboard

When adding a refresh indicator with scroll controller attached to the listview, scroll controller gets disposed and I can't find a way to fix it.

Open Ashwin1002 opened this issue 1 year ago • 1 comments

The error is : ════════ Exception caught by widgets library ═══════════════════════════════════ The following assertion was thrown building NotificationListener<OverscrollIndicatorNotification>: A ScrollController was used after being disposed. Once you have called dispose() on a ScrollController, it can no longer be used. The relevant error-causing widget was: RefreshIndicator RefreshIndicator:file:///Users/ashwinshrestha/development/medhavhi_app/lib/src/class/presentation/paginated_list/view/paginated_list_view.dart:87:53

The code is:

RefreshIndicator.adaptive( onRefresh: () async => _paginationBloc.add(const FetchItems(refresh: true)), child: ElasticListView( // controller: _scrollController, itemCount: state.hasReachedMax ? state.data.length : state.data.length + 1, itemBuilder: (context, index) { return index >= state.data.length ? widget.paginationLoadingWidget ?? SizedBox( height: 80.v, width: context.deviceWidth, child: const Center( child: CupertinoActivityIndicator(), ), ) : widget.itemBuilder(context, index, state.data[index]); }, ), )

Ashwin1002 avatar Jan 21 '24 18:01 Ashwin1002