infinite_scroll_pagination icon indicating copy to clipboard operation
infinite_scroll_pagination copied to clipboard

getting this exception with new version 3.2.0

Open raviranjan31 opened this issue 3 years ago • 5 comments

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.

  • 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('/sdks/flutter/packages/flutter/lib/src/widgets/binding.dart'). WidgetsBinding.instance.addPostFrameCallback((_) { ^^^^^^^^^^^^^^^^^^^^ Error: Compilation failed.

raviranjan31 avatar May 28 '22 14:05 raviranjan31

Same here

elmurphy avatar May 29 '22 19:05 elmurphy

Just accept the pull request please

elmurphy avatar May 29 '22 19:05 elmurphy

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.

  • 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../FlutterProjects/flutter/packages/flutter/lib/src/widgets/binding.dart'). Try calling using ?. instead. WidgetsBinding.instance.addPostFrameCallback((_) { ^^^^^^^^^^^^^^^^^^^^

FAILURE: Build failed with an exception.

bdaykid avatar May 30 '22 01:05 bdaykid

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((_) {.

lohhans avatar Jun 08 '22 22:06 lohhans

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.

clragon avatar Jun 09 '22 05:06 clragon