../../../your_pub/lib/src/framework.dart:275:26: Warning: Operand of null-aware operation '!' has type'SchedulerBinding' which excludes null.
[] - 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart'('../../../code/flutter_3/packages/flutter/lib/src/scheduler/binding.dart').
[]if(SchedulerBinding.instance!.schedulerPhase ==
上面的警告虽然不会影响应用的编译,但是长久来看,还是需要解决的。
原因为何
原因是从 flutter 3 开始, SchedulerBinding.instance返回的是一个 非 null 实例,当我们使用SchedulerBinding.instance!.schedulerPhase 会得到这样的警告Warning: Operand of null-aware operation '!' has type 'SchedulerBinding' which excludes null.