Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getting this exception with new version 3.2.0 #204

Closed
raviranjan31 opened this issue May 28, 2022 · 5 comments
Closed

getting this exception with new version 3.2.0 #204

raviranjan31 opened this issue May 28, 2022 · 5 comments

Comments

@raviranjan31
Copy link

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.
@elmurphy
Copy link

Same here

@elmurphy
Copy link

Just accept the pull request please

@bdaykid
Copy link

bdaykid commented May 30, 2022

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.

@lohhans
Copy link

lohhans commented Jun 8, 2022

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
Copy link
Collaborator

clragon commented Jun 9, 2022

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.

@EdsonBueno EdsonBueno closed this as not planned Won't fix, can't repro, duplicate, stale Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants