Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The implementation of 'schedulingStrategy' in the non-abstract class 'CustomFlutterBinding' does not conform to its interface #1251

Closed
icemioi opened this issue Jun 29, 2021 · 14 comments

Comments

@icemioi
Copy link

icemioi commented Jun 29, 2021

Error: The implementation of 'schedulingStrategy' in the non-abstract class 'CustomFlutterBinding' does not conform to its interface.
class CustomFlutterBinding extends WidgetsFlutterBinding with BoostFlutterBinding

@xujinping
Copy link
Collaborator

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

@icemioi
Copy link
Author

icemioi commented Jun 30, 2021

使用 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 {
    ^

@icemioi
Copy link
Author

icemioi commented Jun 30, 2021

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

就是报的这个错误

@ColdPaleLight
Copy link
Collaborator

看你这个报错和Boost没啥关系,boost也没有复写过schedulingStrategy这个方法。你用的哪个flutter版本

@icemioi
Copy link
Author

icemioi commented Jul 1, 2021

Flutter 2.2.2
flutter_boost v3.0-preview.6

@ColdPaleLight
Copy link
Collaborator

好的,我试一下

@ColdPaleLight
Copy link
Collaborator

另外example有这个问题吗

@icemioi
Copy link
Author

icemioi commented Jul 1, 2021

另外example有这个问题吗

example 可以运行。 在已有 Android 工程中 新增一个 flutter module。 按照 教程增加 flutter_boost依赖,按照教程初始化。 就报错了,和 flutter 版本应该无关

@ColdPaleLight
Copy link
Collaborator

那你那边能提供一个可复现的demo吗,另外你那边有其他自定义的WidgetsFlutterBinding吗

@FriMay0
Copy link

FriMay0 commented Jul 1, 2021

@ColdPaleLight 好像是Null safety的问题,新建一个Null safety的Flutter项目,导入flutter_boost,初始化CustomFlutterBinding会报错

@icemioi
Copy link
Author

icemioi commented Jul 1, 2021

@ColdPaleLight 与 Null safety 有关, 增加 // @Dart=2.9 之后可以正常编译

@ColdPaleLight
Copy link
Collaborator

那这部分需要后期适配Null safety再统一看一下

@ColdPaleLight
Copy link
Collaborator

先关了

@f2yu
Copy link

f2yu commented Jul 14, 2021

null satety的问题,pubspec.yaml文件中,把environment改为sdk: ">=2.9.0 <3.0.0"然后不使用flutter的此特性,可暂时解决问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants