After updating Flutter 3.0 below compile error occured. This error has no ref to my code. It refers to framework.
Launching lib/main.dart on Chrome in debug mode...
lib/main.dart:1
: Warning: Operand of null-aware operation '!' has type 'SchedulerBinding' which excludes null.
../…/src/framework.dart:275
- 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('../snap/flutter/common/flutter/packages/flutter/lib/src/scheduler/binding.dart').
package:flutter/…/scheduler/binding.dart:1
if (SchedulerBinding.instance!.schedulerPhase ==
It's expected when you migrate to Flutter 3.0. The docs also mention about this:
Warning: Operand of null-aware operation '!' has type 'SchedulerBinding' which excludes null.
These are caused by a simplification of the API (the instance property on bindings is now non-nullable), combined with an eager compiler that wants to report any case where redundant null-aware operators (such as ! and ?.) that are used when they’re not necessary.
You can update your packages by running flutter pub upgrade
.
If the issue persist, (say, some of the packages are still giving you this error), you can either ignore it as this is just a warning or simply edit the source file and remove ?
and/or !
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With