4

I just upgraded my flutter to the latest version, (3.0.0) and My projects keeps giving me these warnings and Errors:

../../../../flutter/.pub-cache/hosted/pub.dartlang.org/syncfusion_flutter_pdfviewer-20.1.55-beta/lib/src/control/pdf_page_view.dart:196:23: Warning: Operand of null-aware operation '?.' has type 'PaintingBinding' which excludes null.
 - 'PaintingBinding' is from 'package:flutter/src/painting/binding.dart' ('../../../../flutter/packages/flutter/lib/src/painting/binding.dart').
      PaintingBinding.instance?.imageCache?.clear();
                      ^
../../../../flutter/.pub-cache/hosted/pub.dartlang.org/syncfusion_flutter_pdfviewer-20.1.55-beta/lib/src/control/pdf_page_view.dart:197:23: Warning: Operand of null-aware operation '?.' has type 'PaintingBinding' which excludes null.
 - 'PaintingBinding' is from 'package:flutter/src/painting/binding.dart' ('../../../../flutter/packages/flutter/lib/src/painting/binding.dart').
      PaintingBinding.instance?.imageCache?.clearLiveImages();
                      ^
../../../../flutter/.pub-cache/hosted/pub.dartlang.org/syncfusion_flutter_pdfviewer-20.1.55-beta/lib/src/control/pdf_scrollable.dart:397:22: Warning: Operand of null-aware operation '?.' has type 'WidgetsBinding' which excludes null.
 - 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../../../flutter/packages/flutter/lib/src/widgets/binding.dart').
      WidgetsBinding.instance?.addPostFrameCallback((Duration timeStamp) {
                     ^
../../../../flutter/.pub-cache/hosted/pub.dartlang.org/syncfusion_flutter_pdfviewer-20.1.55-beta/lib/src/control/pdfviewer_canvas.dart:793:22: Warning: Operand of null-aware operation '?.' has type 'WidgetsBinding' which excludes null.
 - 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../../../flutter/packages/flutter/lib/src/widgets/binding.dart').
      WidgetsBinding.instance?.addPostFrameCallback((Duration timeStamp) {
                     ^
../../../../flutter/.pub-cache/hosted/pub.dartlang.org/syncfusion_flutter_pdfviewer-20.1.55-beta/lib/src/control/scroll_head_overlay.dart:288:20: Warning: Operand of null-aware operation '?.' has type 'WidgetsBinding' which excludes null.
 - 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../../../flutter/packages/flutter/lib/src/widgets/binding.dart').
    WidgetsBinding.instance?.addPostFrameCallback((Duration timeStamp) {
                   ^
../../../../flutter/.pub-cache/hosted/pub.dartlang.org/cached_network_image-3.2.0/lib/src/image_provider/cached_network_image_provider.dart:109:29: Warning: Operand of null-aware operation '?.' has type 'PaintingBinding' which excludes null.
 - 'PaintingBinding' is from 'package:flutter/src/painting/binding.dart' ('../../../../flutter/packages/flutter/lib/src/painting/binding.dart').
      () => PaintingBinding.instance?.imageCache?.evict(key),
                            ^
../../../../flutter/.pub-cache/hosted/pub.dartlang.org/cached_network_image-3.2.0/lib/src/image_provider/multi_image_stream_completer.dart:152:22: Warning: Operand of null-aware operation '?.' has type 'SchedulerBinding' which excludes null.
 - 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('../../../../flutter/packages/flutter/lib/src/scheduler/binding.dart').
    SchedulerBinding.instance?.scheduleFrameCallback(_handleAppFrame);

Is this a bug in Flutter and Dart, Or should do something about it.

SinaMN75
  • 6,742
  • 5
  • 28
  • 56

1 Answers1

1

This is because your plugins have not updated to the latest version which make some changes to null safety to the binding widgets.

As stated here null has been excluded from this binding widget: Warning: Operand of null-aware operation '?.' has type 'SchedulerBinding' which excludes null.

The best thing to do is looking if the authors of the plugin have updated their plugin or flutter downgrade to revert to your earlier installed version of Flutter.

SemBauke
  • 147
  • 11
  • aw, so this is a new change on dart null safety system? – SinaMN75 May 14 '22 at 07:36
  • Yes, but these are warnings so you can also just ignore them. – SemBauke May 14 '22 at 07:46
  • Have you tried downgrading to an older Flutter version? The latest version introduces some new warnings as you can see. if you recently upgraded you can use `flutter downgrade` – SemBauke May 16 '22 at 14:43
  • The issue is due to the presence of outdated packages. You can fix this by running flutter pub upgrade inside your app directory. But There is no guarantee that all new package versions are available. so wait till authors update those. – Md omer arafat Jun 16 '22 at 05:29
  • Downgrading my flutter version to 2.10 helped in solving this issue – Sandeep Singh Oct 14 '22 at 10:30