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

Android build failed using infinite_scroll_pagination version 3.2.0 and flutter version 2.10.5 #200

Closed trungtkradium closed 2 years ago

trungtkradium commented 2 years ago

It gives the following error.

/C:/Users/****/AppData/Local/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 p
otentially null.
 - 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('/C:/Users/****/fvm/versions/2.10.5/packages/flutter/lib/src/widgets/binding.dart').
Try calling using ?. instead.
        WidgetsBinding.instance.addPostFrameCallback((_) {
                                ^^^^^^^^^^^^^^^^^^^^

FAILURE: Build failed with an exception.

* Where:
Script 'C:\Users\****\fvm\versions\2.10.5\packages\flutter_tools\gradle\flutter.gradle' line: 1102

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\Users\****\fvm\versions\2.10.5\bin\flutter.bat'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 23s
Running Gradle task 'assembleDebug'...                             24.3s
Exception: Gradle task assembleDebug failed with exit code 1
make: *** [Makefile:8: run-app-debug] Error 1

I'm using infinite_scroll_pagination 3.2.0 And using fvm for flutter version

Flutter doctor:

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.10.5, on Microsoft Windows [Version 10.0.22000.675], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Build Tools 2019 16.11.10)
[√] Android Studio (version 2021.2)
[√] VS Code (version 1.66.1)
[√] Connected device (4 available)
[√] HTTP Host Availability

• No issues found!
pg598595 commented 2 years ago

Facing the same issue, Can anyone please help.

appinteractive commented 2 years ago

https://docs.flutter.dev/development/tools/sdk/release-notes/release-notes-3.0.0

193 #201

For now, you should stick to 3.1.0

trungtkradium commented 2 years ago

How about if my project is not ready for 3.1.0 🤔

Rostyslav91 commented 2 years ago

How about if my project is not ready for 3.1.0 🤔

Hi, change infinite_scroll_pagination: ^3.2.0 to infinite_scroll_pagination: ^3.1.0

appinteractive commented 2 years ago

More like infinite_scroll_pagination: 3.1.0 to pin it for now