When I try to run my flutter project I get the error below. What could be the cause? ......................................................................................................................................................................................................................................................................................................................................................................................................................
Launching lib\main.dart on Android SDK built for x86 in debug mode...
Running Gradle task 'assembleDebug'...
/C:/src/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/carousel_slider-4.1.1/lib/carousel_slider.dart:268:7: Error: No named parameter with the name 'padEnds'.
padEnds: widget.options.padEnds,
^^^^^^^
/C:/src/flutter/flutter/packages/flutter/lib/src/widgets/page_view.dart:664:3: Context: Found this candidate, but the arguments don't match.
PageView.builder({
^^^^^^^^^^^^^^^^
/C:/src/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging_platform_interface-3.2.0/lib/src/method_channel/utils/exception.dart:13:11: Error: Method not found: 'Error.throwWithStackTrace'.
Error.throwWithStackTrace(exception, stackTrace);
^^^^^^^^^^^^^^^^^^^
/C:/src/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging_platform_interface-3.2.0/lib/src/method_channel/utils/exception.dart:16:9: Error: Method not found: 'Error.throwWithStackTrace'.
Error.throwWithStackTrace(
^^^^^^^^^^^^^^^^^^^
/C:/src/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging_platform_interface-3.2.0/lib/src/method_channel/utils/exception.dart:11:7: Error: A non-null value must be returned since the return type 'Never' doesn't allow null.
Never convertPlatformException(Object exception, StackTrace stackTrace) {
^
FAILURE: Build failed with an exception.
* Where:
Script 'C:\src\flutter\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1035
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\src\flutter\flutter\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 3m 41s
Exception: Gradle task assembleDebug failed with exit code 1
These are my dependencies in my pubspec.yaml
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.3
# google_fonts: ^2.1.0
google_fonts: 2.2.0
flutter_icons_nullsafty: ^1.0.0
http: ^0.13.3
cached_network_image: ^3.1.0
encrypt: ^5.0.1
flutter_svg: ^0.22.0
qr_flutter: ^4.0.0
clipboard: ^0.1.3
share: ^2.0.4
qr_code_scanner: ^0.5.2
fluro: ^2.0.3
url_launcher: ^6.0.10
image_picker: ^0.8.4
country_code_picker: ^2.0.2
introduction_screen: ^2.1.0
pin_code_fields: ^7.3.0
provider: ^6.0.0
hive: ^2.0.4
hive_flutter: ^1.1.0
flutter_secure_storage: ^4.2.1
local_auth: ^1.1.7
permission_handler: ^8.1.4 2
fl_chart: ^0.40.0
carousel_slider: ^4.0.0
web3dart: ^2.3.1
device_info_plus: ^2.1.0
package_info_plus: ^1.3.0
intl: ^0.17.0
timeago: ^3.1.0
razorpay_flutter: ^1.2.7
flutter_paystack: ^1.0.5 1
flutter_braintree: ^2.0.0 1
loading_overlay: ^0.3.0
lazy_load_scrollview: ^1.3.0
shimmer: ^2.0.0
in_app_review: ^2.0.3
image_cropper: ^1.4.1
ntp: ^2.0.0
uuid: ^3.0.4
cron: ^0.3.2
dotted_border: ^2.0.0 1
translator: ^0.1.7
firebase_core: ^1.6.0
firebase_messaging: ^10.0.9
firebase_analytics: ^8.3.4
firebase_dynamic_links: ^3.0.1
flutter doctor -v response
C:\Users\USER>flutter doctor -v
[√] Flutter (Channel unknown, 2.2.0, on Microsoft Windows [Version 10.0.19041.264], locale en-US)
• Flutter version 2.2.0 at C:\src\flutter\flutter
• Framework revision b22742018b (1 year ago), 2021-05-14 19:12:57 -0700
• Engine revision a9d88a4d18
• Dart version 2.13.0
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at C:\Users\USER\Documents\Sdk
• Platform android-31, build-tools 30.0.2
• ANDROID_HOME = C:\Users\USER\Documents\Sdk
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.12 7-b1504.28-7817840)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Android Studio (version 4.1.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.12 7-b1504.28-7817840)
[√] VS Code (version 1.67.1)
• VS Code at C:\Users\USER\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.23.0
[√] Connected device (2 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 6.0 (API 23) (emulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 100.0.4896.127
• No issues found!
CodePudding user response:
My guess is that some dependencies are using deprecated methods (which are removed in the newer Flutter version).
Try the following commands (WARNING: you will most likely have to update your codebase after this, and your packages as well.)
- Update Flutter -
flutter upgrade
- Get dependencies -
flutter pub get
- Update dependencies
flutter pub upgrade
- Re-fetch dependencies -
flutter pub get
- Update your code to the newest version.
- Rebuild
CodePudding user response:
You are using a too old flutter version. You are using version 2.2.0
padEnds
only became exposed in version 2.5.0
as you can see here:
https://docs.flutter.dev/development/tools/sdk/release-notes/release-notes-2.5.0
78558 Expose padEnds on PageView widget
You need to upgrade your flutter. You can do that by writing
flutter upgrade
though it says in your flutter doctor that you are on an unknown channel so maybe you need to do
flutter channel stable
first