run<T> static method
T
run<T>(
- T fn()
Execute fn inside a reactive batch.
All Rx writes inside fn update their underlying values immediately,
while listener notifications and listened RxComputed re-evaluations are
coalesced and flushed once when the outermost batch completes.
Nested Rx.batch() calls are supported and flush only when the outermost
batch exits.
Implementation
static T run<T>(T Function() fn) {
_batchDepth++;
try {
return fn();
} finally {
_batchDepth--;
if (_batchDepth == 0) {
_flush();
}
}
}