transaction<T> function Null safety

T transaction<T>(
  1. T fn(
      ),
    1. {ReactiveContext? context}
    )

    During a transaction, no derivations (Reaction or Computed

    Implementation

    T transaction<T>(T Function() fn, {ReactiveContext? context}) {
      final ctx = context ?? mainContext
        ..startBatch();
      try {
        return fn();
      } finally {
        ctx.endBatch();
      }
    }