EdsonBueno / infinite_scroll_pagination

Flutter package to help you lazily load and display pages of items as the user scrolls down your screen.
https://pub.dev/packages/infinite_scroll_pagination
MIT License
623 stars 210 forks source link

getting this exception with new version 3.2.0 #204

Closed raviranjan31 closed 1 year ago

raviranjan31 commented 2 years ago

Compiling lib/main.dart for the Web...
Target dart2js failed: Exception: /root/.pub-cache/hosted/pub.dartlang.org/infinite_scroll_pagination-3.2.0/lib/src/ui/paged_sliver_builder.dart:254:33: Error: Method 'addPostFrameCallback' cannot be called on 'WidgetsBinding?' because it is potentially null.

elmurphy commented 2 years ago

Same here

elmurphy commented 2 years ago

Just accept the pull request please

bdaykid commented 2 years ago

Thank you for the lib. Same issue? I revert to 3.1.0 and the problem's gone.

../../FlutterProjects/flutter/.pub-cache/hosted/pub.dartlang.org/infinite_scroll_pagination-3.2.0/lib/src/ui/paged_sliver_builder.dart:254:33: Error: Method 'addPostFrameCallback' cannot be called on 'WidgetsBinding?' because it is potentially null.

FAILURE: Build failed with an exception.

lohhans commented 2 years ago

I've solved this error putting a null-check on /.pub-cache/hosted/pub.dartlang.org/infinite_scroll_pagination-3.2.0/lib/src/ui/paged_sliver_builder.dart to don't execute function if the instance is null...

On the line 254 where it's written:

WidgetsBinding.instance.addPostFrameCallback((_) {

change it to:

WidgetsBinding.instance?.addPostFrameCallback((_) {.

clragon commented 2 years ago

version 3.2.0 of this package has specifically removed that so that it removes a warning in flutter version 3.0.

please upgrade to flutter version 3.0. if you do not plan on upgrading to version 3.0, then there is no reason to use version 3.2.0 of this package. you can downgrade to version 3.1.0.