emit method
- A a,
- B b
Sends a message to all watchers.
Implementation
void emit(A a, B b) {
final watchers = _watchers;
if (watchers == null || watchers.isEmpty) return;
_depth += 1;
final end = watchers.length;
try {
for (var i = 0; i < end; i += 1) {
watchers[i]?.call(a, b);
}
} finally {
_depth -= 1;
if (_depth == 0 && _dirty) {
_dirty = false;
watchers.removeWhere((fn) => fn == null);
}
}
}