exec method
Executes the provided callback
as a microtask.
If no other microtask is currently being executed (based on the current microtask version),
the callback
will be scheduled as a microtask using scheduleMicrotask.
Once the microtask is executed, the microtask version number is incremented.
Implementation
void exec(Function callback) {
if (_microtask == _version) {
_microtask++;
scheduleMicrotask(() {
_version++;
_microtask = _version;
callback();
});
}
}