synchronized<T> abstract method

Future<T> synchronized<T>(
  1. FutureOr<T> computation(), {
  2. Duration? timeout,
})

Runs computation holding the lock, released when it completes.

timeout bounds the wait for the lock as in acquire, computation is then never called. Returns the value of computation and rethrows its errors.

Implementation

Future<T> synchronized<T>(
  FutureOr<T> Function() computation, {
  Duration? timeout,
});