The implementation of 'schedulingStrategy' in the non-abstract class 'CustomFlutterBinding' does not conform to its interface
Error: The implementation of 'schedulingStrategy' in the non-abstract class 'CustomFlutterBinding' does not conform to its interface. class CustomFlutterBinding extends WidgetsFlutterBinding with BoostFlutterBinding
Error: The implementation of 'schedulingStrategy' in the non-abstract class 'CustomFlutterBinding' does not conform to its interface. class CustomFlutterBinding extends WidgetsFlutterBinding with BoostFlutterBinding
参考 demo 中的 main.dart 在runApp前 要初始化 BoostFlutterBinding
使用 demo 中的 CustomFlutterBinding 并初始化后还是报错
lib/main.dart:8:7: Error: The implementation of 'schedulingStrategy' in the non-abstract class 'CustomFlutterBinding' does not conform to its interface. class CustomFlutterBinding extends WidgetsFlutterBinding with BoostFlutterBinding { ^^^^^^^^^^^^^^^^^^^^ ../../../../../../../Documents/flutter/packages/flutter/lib/src/widgets/binding.dart:1228:7: Context: The return type of the method 'BindingBase with GestureBinding, SchedulerBinding.schedulingStrategy' is 'bool Function({int priority, SchedulerBinding scheduler})', which does not match the return type, 'bool Function({int priority, SchedulerBinding scheduler})', of the overridden method, 'BindingBase with GestureBinding, SchedulerBinding.schedulingStrategy'.
- 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('../../../../../../../Documents/flutter/packages/flutter/lib/src/scheduler/binding.dart'). Change to a subtype of 'bool Function({int priority, SchedulerBinding scheduler})'. class WidgetsFlutterBinding extends BindingBase with GestureBinding, SchedulerBinding, ServicesBinding, PaintingBinding, SemanticsBinding, RendererBinding, WidgetsBinding { ^ ../../../../../../../Documents/flutter/packages/flutter/lib/src/widgets/binding.dart:1228:7: Context: This is the overridden method ('schedulingStrategy'). class WidgetsFlutterBinding extends BindingBase with GestureBinding, SchedulerBinding, ServicesBinding, PaintingBinding, SemanticsBinding, RendererBinding, WidgetsBinding { ^
Error: The implementation of 'schedulingStrategy' in the non-abstract class 'CustomFlutterBinding' does not conform to its interface. class CustomFlutterBinding extends WidgetsFlutterBinding with BoostFlutterBinding
参考 demo 中的 main.dart 在runApp前 要初始化 BoostFlutterBinding
就是报的这个错误
看你这个报错和Boost没啥关系,boost也没有复写过schedulingStrategy这个方法。你用的哪个flutter版本
Flutter 2.2.2 flutter_boost v3.0-preview.6
好的,我试一下
另外example有这个问题吗
另外example有这个问题吗
example 可以运行。 在已有 Android 工程中 新增一个 flutter module。 按照 教程增加 flutter_boost依赖,按照教程初始化。 就报错了,和 flutter 版本应该无关
那你那边能提供一个可复现的demo吗,另外你那边有其他自定义的WidgetsFlutterBinding吗
@ColdPaleLight 好像是Null safety的问题,新建一个Null safety的Flutter项目,导入flutter_boost,初始化CustomFlutterBinding会报错
@ColdPaleLight 与 Null safety 有关, 增加 // @dart=2.9 之后可以正常编译
那这部分需要后期适配Null safety再统一看一下
先关了
null satety的问题,pubspec.yaml文件中,把environment改为sdk: ">=2.9.0 <3.0.0"然后不使用flutter的此特性,可暂时解决问题