# transaction<R> abstract method

R transaction<R>(

1. R fn()

)

Perform multiple operations atomically.

Events emitted inside `fn` are batched into a single BulkChange.

### Example

    final obs = Obs<List<int>>([]);

    obs.listen((event) => print(event));

    obs.transaction(() {
      obs.add(1);
      obs.add(2);
      obs.add(3);
    });
    // Emits one BulkChange with 3 ListChange events

## Implementation

    R transaction<R>(R Function() fn);