synchronized<T> method

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

Executes computation when lock is available.

Only one asynchronous block can run while the lock is retained.

Implementation

Future<T> synchronized<T>(FutureOr<T> Function() computation,
    {Duration? timeout}) {
  return impl.objectSynchronized<T>(this, computation, timeout: timeout);
}