Skip to content

Instantly share code, notes, and snippets.

@dmitryelagin
Created October 8, 2020 08:50
abstract class Timer {
factory Timer(Duration duration, void callback()) {
// Create timer with current zone
return Zone.current
.createTimer(duration, Zone.current.bindCallbackGuarded(callback));
}
// ...
// Create timer from environment
external static Timer _createTimer(Duration duration, void callback());
}
class _RootZone implements Zone {
// ...
Timer createTimer(Duration duration, void f()) {
return Timer._createTimer(duration, f);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment