Flutter_Operand of null-aware op

2022-05-12  本文已影响0人  Eyes_cc

【问题】

/Applications/flutter_xx/flutter/.pub-cache/hosted/pub.flutter-io.cn/flutter_easyloading-3.0.3/lib/src/widgets/overlay_entry.dart:37:24: Warning: Operand of null-aware operation '?.' has type
'SchedulerBinding' which excludes null.
 - 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('/Applications/flutter_xx/flutter/packages/flutter/lib/src/scheduler/binding.dart').
      SchedulerBinding.instance?.addPostFrameCallback((_) {
                       ^
/Applications/flutter_xx/flutter/.pub-cache/hosted/pub.flutter-io.cn/flutter_easyloading-3.0.3/lib/src/widgets/container.dart:64:24: Warning: Operand of null-aware operation '?.' has type
'SchedulerBinding' which excludes null.
 - 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('/Applications/flutter_xx/flutter/packages/flutter/lib/src/scheduler/binding.dart').
      SchedulerBinding.instance?.schedulerPhase ==
                       ^

当Flutter的SDK版本是最新或比较新的时候,此时跑项目,由于一些三方插件可能还没有更新或者本地不是最新的,所以,会出现上面的错误(比如上面报错的是flutter_easyloading插件)。

解决办法
有两种

第一种. 更新该三方插件(取决于作者有更新)。

第二种.
复制路径/Applications/flutter_xx/flutter/.pub-cache/hosted/pub.flutter-io.cn/flutter_easyloading-3.0.3/lib/src/widgetsfinder前往中,回车。打开对应的报错文件,定位到该行,手动修改。

上一篇 下一篇

猜你喜欢

热点阅读