batch<R> static method

R batch<R>(
  1. R callback()
)

Executes callback in a synchronous batch.

Notifications are deferred until the batch completes, ensuring that observers are only notified once even if multiple values change.

// Example usage:

Levit.batch(() {
  firstName.value = 'Jane';
  lastName.value = 'Doe';
});

Returns the value returned by callback.

Throws any exception thrown by callback.

Implementation

static R batch<R>(R Function() callback) {
  return Lx.batch(callback);
}