SchedulerHost class abstract
Platform host interface providing cooperative macrotask yielding and scheduling.
In pure-Dart VM and SSR environments, DefaultSchedulerHost uses zero-duration
Timer macrotasks to yield execution without depending on browser APIs.
In browser DOM applications, a custom host (such as one using window.requestAnimationFrame,
window.requestIdleCallback, or MessageChannel) can be installed via BloomScheduler.setHost.
class CustomSchedulerHost implements SchedulerHost {
@override
bool get isSynchronous => false;
@override
void scheduleWork(void Function() runQueue) {
Timer.run(runQueue);
}
@override
Future<void> yieldToHost() {
final completer = Completer<void>();
Timer(Duration.zero, completer.complete);
return completer.future;
}
}
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isSynchronous → bool
-
Whether this host executes synchronously without deferral or time-slicing (e.g. in fast SSR).
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
scheduleWork(
void runQueue()) → void -
Requests the host environment to invoke
runQueuein the next event loop turn. -
toString(
) → String -
A string representation of this object.
inherited
-
yieldToHost(
) → Future< void> - Yields execution to the host event loop, completing when the platform is ready to resume.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited