vedartm / paginate_firestore

A flutter package to simplify pagination with firestore data 🗃
https://pub.dev/packages/paginate_firestore
MIT License
113 stars 138 forks source link

Exception when ScrollController will be disposed #122

Closed MoritzOtto closed 2 years ago

MoritzOtto commented 2 years ago

Hello,

As paramter to paginate_firestore we provide a scrollcontroller. When using the widget at one time the widget PaginateFirestore will be disposed, while the widget that owns and creats the scrollcontroller is still alive. For that reason I would expect that the provided scrollcontroller wont get disposed. When this happens the seccond time I got the following exception.

Exception has occurred. FlutterError (A ScrollController was used after being disposed. 
Once you have called dispose() on a ScrollController, it can no longer be used.)

Why is the scrollcontroller going to disposed when PaginateFirestore will be disposed? I think for us this will fix our scenario.

regards, Moritz

vedartm commented 2 years ago

Hi @MoritzOtto. Thanks for using the plugin. Since the scroll controller is attached to PaginateFirestore, it gets disposed together. It is the intended behavior as you can see here.