Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Execution failed for task ':app:compileFlutterBuildDebug'. > Process 'command 'C:\FlutterSdk\flutter\bin\flutter.bat'

/C:/FlutterSdk/flutter/.pub-cache/hosted/pub.dartlang.org/fl_chart-0.50.5/lib/src/chart/pie_chart/pie_chart.dart:42:29: Error: Method 'addPostFrameCallback' cannot be called on 'WidgetsBinding?' because it is potentially null.

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

FAILURE: Build failed with an exception.

  • Where: Script 'C:\FlutterSdk\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1102

  • What went wrong: Execution failed for task ':app:compileFlutterBuildDebug'.

Process 'command 'C:\FlutterSdk\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 33s Running Gradle task 'assembleDebug'... 38.2s Exception: Gradle task assembleDebug failed with exit code 1

like image 955
Yahya Kater Avatar asked Feb 12 '26 02:02

Yahya Kater


2 Answers

use flutter pub cache repair command

because flutter stores the data in its own storage, and if it gets full, it will throw an error

like image 132
Ibrokhim Kobilov Avatar answered Feb 13 '26 16:02

Ibrokhim Kobilov


lib provider had breaking changes when migrating to flutter 3 but didn't bump the major version, you can try locking the version in pubspec.yml or migrate to flutter 3 as well...

like image 30
wocesev Avatar answered Feb 13 '26 16:02

wocesev



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!