Reversing the dependency between the scheduler and services layer
Summary
The services layer now depends on the scheduler layer.
Previously, the opposite was true. This may affect you
if you have defined custom bindings overriding
Flutter’s SchedulerBinding
or ServicesBinding
.
Context
Prior to this change, the scheduler layer was dependent
on the services layer. This change reverses the dependency
chain and allows the services layer to make use of the
scheduling primitives in the scheduler layer. For example,
services in the services layer can now schedule tasks by using
SchedulerBinding.scheduleTask
.
Description of change
The change only affects users who are defining their own
custom bindings based on Flutter’s SchedulerBinding
and ServicesBinding
.
Migration guide
Prior to this change, the ServiceBinding
had to be defined before the
SchedulerBinding
. With this change, it is the other way around:
Code before migration:
class FooBinding extends BindingBase with ServicesBinding, SchedulerBinding {
// ...
}
Code after migration:
class FooBinding extends BindingBase with SchedulerBinding, ServicesBinding {
// ...
}
Timeline
Landed in version: 1.18.0
In stable release: 1.20
References
API documentation:
Relevant PRs: