synchronized<T> abstract method

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

    Executes computation when lock is available.

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

    If timeout is specified, it will try to grab the lock and will not call the computation callback and throw a TimeoutExpection if the lock cannot be grabbed in the given duration.

    Implementation

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