batch static method

void batch(
  1. void fn()
)

Set the value of multiple MutableCell's simultaneously.

fn is called. Within fn setting MutableCell.value sets the value of the cell but does not trigger an immediate update of its observer cells. Instead the observers of the modified cells are only notified when fn returns.

Implementation

static void batch(void Function() fn) {
  if (_batched) {
    fn();
  }
  else {
    _beginBatch();

    try {
      fn();
    }
    finally {
      _endBatch();
    }
  }
}