Today when I start debbuging the flutter(v3.0.4
) project, shows warning like this:
Launching lib/main.dart on iPod touch (7th generation) in debug mode...
Running Xcode build...
Xcode build done. 13.3s
Debug service listening on ws://127.0.0.1:56272/SE55zaOahPg=/ws
Syncing files to device iPod touch (7th generation)...
../../../../.pub-cache/hosted/pub.dartlang.org/overlay_support-1.2.1/lib/src/overlay_entry.dart:101:24: Warning: Operand of null-aware operation '?.' has type 'WidgetsBinding' which excludes null.
- 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../../../fvm/versions/3.0.4/packages/flutter/lib/src/widgets/binding.dart').
WidgetsBinding.instance?.scheduleFrameCallback((_) => animateRemove());
^
../../../../.pub-cache/hosted/pub.dartlang.org/scrollable_positioned_list-0.2.3/lib/src/scrollable_positioned_list.dart:439:24: Warning: Operand of null-aware operation '!' has type 'SchedulerBinding' which excludes null.
- 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('../../../../fvm/versions/3.0.4/packages/flutter/lib/src/scheduler/binding.dart').
SchedulerBinding.instance!.addPostFrameCallback((_) {
^
../../../../.pub-cache/hosted/pub.dartlang.org/scrollable_positioned_list-0.2.3/lib/src/scrollable_positioned_list.dart:486:26: Warning: Operand of null-aware operation '!' has type 'SchedulerBinding' which excludes null.
- 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('../../../../fvm/versions/3.0.4/packages/flutter/lib/src/scheduler/binding.dart').
SchedulerBinding.instance!.addPostFrameCallback((_) {
^
../../../../.pub-cache/hosted/pub.dartlang.org/scrollable_positioned_list-0.2.3/lib/src/positioned_list.dart:312:24: Warning: Operand of null-aware operation '!' has type 'SchedulerBinding' which excludes null.
- 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('../../../../fvm/versions/3.0.4/packages/flutter/lib/src/scheduler/binding.dart').
SchedulerBinding.instance!.addPostFrameCallback((_) {
this warning was come from the third party dependencies, it it possible to resolve the warnings? I did not any warning in my flutter project. what should I do to make the warning disappeared?
CodePudding user response:
This is normal, since the Flutter 3 update, the instance
property has been made non-nullable. Not all packages have been updated to accommodate this yet, which is why you're seeing all these warnings.
The only thing to do is check the packages for updates regularly, and if there are, updating your pubspec.yaml
to use the latest version.