Home > Mobile >  'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1156
'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1156

Time:07-26

I can not run my project the error is:

/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/visibility_detector-0.2.2/lib/src/visibility_detector_layer.dart:193:22: Warning: Operand of null-aware operation '!' has type 'SchedulerBinding' which excludes null.

  • 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('/C:/flutter/packages/flutter/lib/src/scheduler/binding.dart'). SchedulerBinding.instance! ^

FAILURE: Build failed with an exception.

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

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

Process 'command 'C:\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 line 1156 code image

CodePudding user response:

I got this kind of problem when I upgraded from Flutter 2.10.5 to Flutter 3.0.5. This can due to packages you import that are not compatible with Flutter 3 yet.

To solve this, try first to update your packages to the latest version:

flutter pub upgrade
flutter pub upgrade --major-versions
flutter pub get

If you still have the problem, look at the errors in the logs to see which package causes the issue. Then you can go to its Github page to see if other people experience the problem and if an update is supposed to come soon.

CodePudding user response:

Scroll top of the error log ..that might be the real error. for SchedulerBinding is just a warning.

try

flutter pub outdated
  • Related