CINXE.COM
synchronized | Dart package
<!DOCTYPE html> <html lang="en-us"><head><script src="https://www.googletagmanager.com/gtm.js?id=GTM-MX6DBN9" async="async"></script><script src="/static/hash-mh7qv2oc/js/gtm.js" async="async"></script><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="ie=edge"/><meta name="viewport" content="width=device-width, initial-scale=1"/><meta name="twitter:card" content="summary"/><meta name="twitter:site" content="@dart_lang"/><meta name="twitter:description" content="Lock mechanism to prevent concurrent access to asynchronous code."/><meta name="twitter:image" content="https://pub.dev/static/hash-mh7qv2oc/img/pub-dev-icon-cover-image.png"/><meta property="og:type" content="website"/><meta property="og:site_name" content="Dart packages"/><meta property="og:title" content="synchronized | Dart package"/><meta property="og:description" content="Lock mechanism to prevent concurrent access to asynchronous code."/><meta property="og:image" content="https://pub.dev/static/hash-mh7qv2oc/img/pub-dev-icon-cover-image.png"/><meta property="og:url" content="https://pub.dev/packages/synchronized"/><title>synchronized | Dart package</title><link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Google+Sans:wght@400;500;700&family=Google+Sans+Display:wght@400&family=Google+Sans+Text:wght@400;500;700&family=Google+Sans+Mono:wght@400;700&display=swap"/><link rel="shortcut icon" href="/favicon.ico?hash=nk4nss8c7444fg0chird9erqef2vkhb8"/><meta rel="apple-touch-icon" href="/static/hash-mh7qv2oc/img/apple-touch-icon.png"/><meta rel="apple-touch-icon-precomposed" href="/static/hash-mh7qv2oc/img/apple-touch-icon.png"/><link rel="stylesheet" href="https://www.gstatic.com/glue/v25_0/ccb.min.css"/><link rel="search" type="application/opensearchdescription+xml" title="Dart packages" href="/osd.xml"/><link rel="canonical" href="https://pub.dev/packages/synchronized"/><meta name="description" content="Lock mechanism to prevent concurrent access to asynchronous code."/><link rel="alternate" type="application/atom+xml" title="Updated Packages Feed for Pub" href="/feed.atom"/><link rel="stylesheet" type="text/css" href="/static/hash-mh7qv2oc/material/bundle/styles.css"/><link rel="stylesheet" type="text/css" href="/static/hash-mh7qv2oc/css/style.css"/><script src="/static/hash-mh7qv2oc/material/bundle/script.min.js" defer="defer"></script><script src="/static/hash-mh7qv2oc/js/script.dart.js" defer="defer"></script><script src="https://www.gstatic.com/brandstudio/kato/cookie_choice_component/cookie_consent_bar.v3.js" defer="defer" data-autoload-cookie-consent-bar="true"></script><meta name="pub-page-data" content="eyJwa2dEYXRhIjp7InBhY2thZ2UiOiJzeW5jaHJvbml6ZWQiLCJ2ZXJzaW9uIjoiMy4zLjEiLCJsaWtlcyI6NTY1LCJwdWJsaXNoZXJJZCI6InRla2FydGlrLmNvbSIsImlzRGlzY29udGludWVkIjpmYWxzZSwiaXNMYXRlc3QiOnRydWV9LCJzZXNzaW9uQXdhcmUiOmZhbHNlfQ=="/><link rel="preload" href="/static/hash-mh7qv2oc/highlight/highlight-with-init.js" as="script"/></head><body class="light-theme"><script src="/static/hash-mh7qv2oc/js/dark-init.js"></script><noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MX6DBN9" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript><div class="site-header"><button class="hamburger" aria-label="menu toggle"></button><a class="logo" href="/" aria-label="Go to the landing page of pub.dev"><img class="site-logo" src="/static/hash-mh7qv2oc/img/pub-dev-logo.svg" alt="" width="140" height="30" role="presentation"/></a><div class="site-header-space"></div><div class="site-header-mask"></div><div class="site-header-search"><form action="/packages" method="GET"><input class="site-header-search-input" name="q" placeholder="New search..." autocomplete="on" title="Search"/></form></div><nav class="site-header-nav scroll-container"><div class="nav-login-container"><button id="-account-login" class="nav-main-button link">Sign in</button></div><div class="nav-container nav-help-container hoverable"><button class="nav-main-button">Help</button><div class="nav-hover-popup"><div class="nav-table-columns"><div class="nav-table-column"><h3>pub.dev</h3><a class="nav-link" href="/help/search" rel="noopener" target="_blank">Searching for packages</a><a class="nav-link" href="/help/scoring" rel="noopener" target="_blank">Package scoring and pub points</a></div><div class="nav-table-column"><h3>Flutter</h3><a class="nav-link" href="https://flutter.dev/using-packages/" rel="noopener" target="_blank">Using packages</a><a class="nav-link" href="https://flutter.dev/developing-packages/" rel="noopener" target="_blank">Developing packages and plugins</a><a class="nav-link" href="https://dart.dev/tools/pub/publishing" rel="noopener" target="_blank">Publishing a package</a></div><div class="nav-table-column"><h3>Dart</h3><a class="nav-link" href="https://dart.dev/guides/packages" rel="noopener" target="_blank">Using packages</a><a class="nav-link" href="https://dart.dev/tools/pub/publishing" rel="noopener" target="_blank">Publishing a package</a></div></div></div></div><div class="nav-container nav-help-container-mobile foldable"><h3 class="foldable-button">pub.dev <img class="foldable-icon" src="/static/hash-mh7qv2oc/img/nav-mobile-foldable-icon.svg" alt="toggle folding of the section" width="13" height="6"/></h3><div class="foldable-content"><a class="nav-link" href="/help/search" rel="noopener" target="_blank">Searching for packages</a><a class="nav-link" href="/help/scoring" rel="noopener" target="_blank">Package scoring and pub points</a></div></div><div class="nav-container nav-help-container-mobile foldable"><h3 class="foldable-button">Flutter <img class="foldable-icon" src="/static/hash-mh7qv2oc/img/nav-mobile-foldable-icon.svg" alt="toggle folding of the section" width="13" height="6"/></h3><div class="foldable-content"><a class="nav-link" href="https://flutter.dev/using-packages/" rel="noopener" target="_blank">Using packages</a><a class="nav-link" href="https://flutter.dev/developing-packages/" rel="noopener" target="_blank">Developing packages and plugins</a><a class="nav-link" href="https://dart.dev/tools/pub/publishing" rel="noopener" target="_blank">Publishing a package</a></div></div><div class="nav-container nav-help-container-mobile foldable"><h3 class="foldable-button">Dart <img class="foldable-icon" src="/static/hash-mh7qv2oc/img/nav-mobile-foldable-icon.svg" alt="toggle folding of the section" width="13" height="6"/></h3><div class="foldable-content"><a class="nav-link" href="https://dart.dev/guides/packages" rel="noopener" target="_blank">Using packages</a><a class="nav-link" href="https://dart.dev/tools/pub/publishing" rel="noopener" target="_blank">Publishing a package</a></div></div></nav><button class="-pub-theme-toggle" aria-label="light/dark theme toggle"></button></div><div id="banner-container"></div><main class="container"><div class="detail-wrapper -active -has-info-box"><div class="detail-header -is-loose"><div class="detail-container"><div class="detail-header-outer-block"><div class="detail-header-content-block"><h1 class="title pub-monochrome-icon-hoverable">synchronized 3.3.1 <span class="pkg-page-title-copy"><img class="pub-monochrome-icon pkg-page-title-copy-icon filter-invert-on-dark" src="/static/hash-mh7qv2oc/img/content-copy-icon.svg" alt="copy "synchronized: ^3.3.1" to clipboard" width="18" height="18" title="Copy "synchronized: ^3.3.1" to clipboard" data-copy-content="synchronized: ^3.3.1" data-ga-click-event="copy-package-version"/><div class="pkg-page-title-copy-feedback"><span class="code">synchronized: ^3.3.1</span> copied to clipboard</div></span></h1><div class="metadata">Published <span><a class="-x-ago" href="" title="Feb 13, 2025" role="button" data-timestamp="1739434954073">43 days ago</a></span> • <a class="-pub-publisher" href="/publishers/tekartik.com"><img class="-pub-publisher-shield filter-invert-on-dark" src="/static/hash-mh7qv2oc/img/material-icon-verified.svg" alt="verified publisher" width="14" height="14" title="Published by a pub.dev verified publisher"/>tekartik.com</a><span class="package-badge" title="Package is compatible with Dart 3.">Dart 3 compatible</span></div><div class="detail-tags-and-like"><div class="detail-tags"><div class="-pub-tag-badge"><span class="tag-badge-main">SDK</span><a class="tag-badge-sub" href="/packages?q=sdk%3Adart" rel="nofollow" title="Packages compatible with Dart SDK">Dart</a><a class="tag-badge-sub" href="/packages?q=sdk%3Aflutter" rel="nofollow" title="Packages compatible with Flutter SDK">Flutter</a></div><div class="-pub-tag-badge"><span class="tag-badge-main">Platform</span><a class="tag-badge-sub" href="/packages?q=platform%3Aandroid" rel="nofollow" title="Packages compatible with Android platform">Android</a><a class="tag-badge-sub" href="/packages?q=platform%3Aios" rel="nofollow" title="Packages compatible with iOS platform">iOS</a><a class="tag-badge-sub" href="/packages?q=platform%3Alinux" rel="nofollow" title="Packages compatible with Linux platform">Linux</a><a class="tag-badge-sub" href="/packages?q=platform%3Amacos" rel="nofollow" title="Packages compatible with macOS platform">macOS</a><a class="tag-badge-sub" href="/packages?q=platform%3Aweb" rel="nofollow" title="Packages compatible with Web platform">web</a><a class="tag-badge-sub" href="/packages?q=platform%3Awindows" rel="nofollow" title="Packages compatible with Windows platform">Windows</a></div></div><div class="detail-like"><button id="-pub-like-icon-button" class="mdc-icon-button" data-ga-click-event="toggle-like" aria-pressed="false" title="Like this package"><img class="mdc-icon-button__icon" src="/static/hash-mh7qv2oc/img/like-inactive.svg" alt="liked status: inactive" width="18" height="18"/><img class="mdc-icon-button__icon mdc-icon-button__icon--on" src="/static/hash-mh7qv2oc/img/like-active.svg" alt="liked status: active" width="18" height="18"/></button><span class="likes-count"><span id="likes-count">565</span></span></div></div></div></div></div></div><div class="detail-container"><div class="detail-lead"><div class="detail-metadata-toggle"><div class="detail-metadata-toggle-icon">→</div><h3 class="detail-lead-title">Metadata</h3></div><p class="detail-lead-text">Lock mechanism to prevent concurrent access to asynchronous code.</p><p class="detail-lead-more"><a class="detail-metadata-toggle">More...</a></p></div></div><div class="detail-body"><div class="detail-tabs"><div class="detail-tabs-wide-header"><div class="detail-container"><ul class="detail-tabs-header"><li class="detail-tab tab-button detail-tab-readme-title -active">Readme</li><li class="detail-tab tab-link detail-tab-changelog-title"><a href="/packages/synchronized/changelog" role="button">Changelog</a></li><li class="detail-tab tab-link detail-tab-example-title"><a href="/packages/synchronized/example" role="button">Example</a></li><li class="detail-tab tab-link detail-tab-installing-title"><a href="/packages/synchronized/install" role="button">Installing</a></li><li class="detail-tab tab-link detail-tab-versions-title"><a href="/packages/synchronized/versions" role="button">Versions</a></li><li class="detail-tab tab-link detail-tab-analysis-title"><a href="/packages/synchronized/score" role="button">Scores</a></li></ul></div></div><div class="detail-container detail-body-main"><div class="detail-tabs-content"><section class="tab-content detail-tab-readme-content -active markdown-body"><h1 id="synchronized" class="hash-header">synchronized <a href="#synchronized" class="hash-link">#</a></h1> <p>Basic lock mechanism to prevent concurrent access to asynchronous code.</p> <p><a href="https://pub.dev/packages/synchronized"><img src="https://img.shields.io/pub/v/synchronized.svg" alt="pub package"></a></p> <h2 id="goal" class="hash-header">Goal <a href="#goal" class="hash-link">#</a></h2> <p>You were missing hard to debug deadlocks, here it is!</p> <p>The goal is to propose a solution similar to critical sections and offer a simple <code>synchronized</code> API à la Java style. It provides a basic Lock/Mutex solution to allow features like transactions.</p> <p>The name is biased as we are single threaded in Dart. However since we write asychronous code (await) like we would write synchronous code, it makes the overall API feel the same.</p> <p>The goal is to ensure for a single process (single isolate) that some asynchronous operations can run without conflict. It won't solve cross-process (or cross-isolate) synchronization.</p> <p>For single process (single isolate) accessing some resources (database..), it can help to</p> <ul> <li>Provide transaction on database system that don't have transaction mechanism (mongodb, file system)</li> <li>In html application make sure some asynchronous UI operation are not conflicting (login, transition)</li> </ul> <h2 id="feature" class="hash-header">Feature <a href="#feature" class="hash-link">#</a></h2> <ul> <li>By default a lock is not reentrant</li> <li>Timeout support</li> <li>Support for reentrant lock (using Zone)</li> <li>Consistent behavior (i.e. if it is unlocked calling synchronized grab the lock)</li> <li>Values and Errors are properly reported to the caller</li> <li>Work on Browser, DartVM and Flutter</li> <li>No dependencies (other than the sdk itself)</li> </ul> <p>It differs from the <code>pool</code> package used with a resource count of 1 by supporting a reentrant option</p> <h2 id="usage" class="hash-header">Usage <a href="#usage" class="hash-link">#</a></h2> <p>A simple usage example:</p> <pre><code class="language-dart">import 'package:synchronized/synchronized.dart'; main() async { // Use this object to prevent concurrent access to data var lock = new Lock(); ... await lock.synchronized(() async { // Only this block can run (once) until done ... }); } </code></pre> <p>If you need a re-entrant lock you can use</p> <pre><code class="language-dart">var lock = new Lock(reentrant: true); // ... await lock.synchronized(() async { // do some stuff // ... await lock.synchronized(() async { // other stuff } }); </code></pre> <p>A basic lock is not reentrant by default and does not use Zone. It behaves like an async executor with a pool capacity of 1</p> <pre><code class="language-dart">var lock = Lock(); // ... lock.synchronized(() async { // do some stuff // ... }); </code></pre> <p>The return value is preserved</p> <pre><code class="language-dart">int value = await lock.synchronized(() { return 1; }); </code></pre> <p>Using the <code>package:synchronized/extension.dart</code> import, you can turn any object into a lock. <code>synchronized()</code> can then be called on any object</p> <pre><code class="language-dart">import 'package:synchronized/extension.dart'; class MyClass { /// Perform a long action that won't be called more than one at a time. Future performAction() { // Lock at the instance level return synchronized(() async { // ...uninterrupted action }); } } </code></pre> <h2 id="how-it-works" class="hash-header">How it works <a href="#how-it-works" class="hash-link">#</a></h2> <p>The next tasks is executed once the previous one is done</p> <p>Re-entrant locks uses <code>Zone</code> to know in which context a block is running in order to be reentrant. It maintains a list of inner tasks to be awaited for.</p> <h2 id="example" class="hash-header">Example <a href="#example" class="hash-link">#</a></h2> <p>Consider the following dummy code</p> <pre><code class="language-dart">Future writeSlow(int value) async { await Future.delayed(new Duration(milliseconds: 1)); stdout.write(value); } Future write(List<int> values) async { for (int value in values) { await writeSlow(value); } } Future write1234() async { await write([1, 2, 3, 4]); } </code></pre> <p>Doing</p> <pre><code class="language-dart">write1234(); write1234(); </code></pre> <p>would print</p> <pre><code>11223344 </code></pre> <p>while doing</p> <pre><code class="language-dart">lock.synchronized(write1234); lock.synchronized(write1234); </code></pre> <p>would print</p> <pre><code>12341234 </code></pre> <h2 id="the-lock-instance" class="hash-header">The Lock instance <a href="#the-lock-instance" class="hash-link">#</a></h2> <p>Have in mind that the <code>Lock</code> instance must be shared between calls in order to effectively prevent concurrent execution. For instance, in the example below the lock instance is the same between all <code>myMethod()</code> calls.</p> <pre><code class="language-dart">class MyClass { final _lock = new Lock(); Future<void> myMethod() async { await _lock.synchronized(() async { step1(); step2(); step3(); }); } } </code></pre> <p>Typically you would create a global or static instance Lock to prevent concurrent access to a global resource or a class instance Lock to prevent concurrent modifications of class instance data and resources.</p> <h2 id="lockedinlockcanlock-status" class="hash-header">locked/inLock/canLock status <a href="#lockedinlockcanlock-status" class="hash-link">#</a></h2> <h3 id="locked" class="hash-header">locked <a href="#locked" class="hash-link">#</a></h3> <p>For basic and reentrant lock, <code>locked</code> returns whether the lock is currently locked.</p> <p>For multi lock, it returns true if all inner locks <code>locked</code> values are true.</p> <h3 id="inlock" class="hash-header">inLock <a href="#inlock" class="hash-link">#</a></h3> <p>For reentrant locks, <code>inLock</code> returns whether the current zone is locked by the lock. i.e. it is true if the current block is running inside a <code>synchronized</code> block of the lock.</p> <p>For basic lock, it matches the <code>locked</code> property and since it does mean anything, it should not be used as behavior may change in the future.</p> <p>For multi lock, it returns true if all inner locks <code>inLock</code> values are true.</p> <h3 id="canlock" class="hash-header">canLock <a href="#canlock" class="hash-link">#</a></h3> <p>canLock returns whether the lock can be locked immediately.</p> <p>For basic lock, it is true if the lock is not locked.</p> <p>For reentrant lock, it is true if the lock is not locked or if the current zone is locked by the lock.</p> <p>For multi lock, it returns true if all inner locks <code>canLock</code> values are true.</p> <h2 id="multilock" class="hash-header">MultiLock <a href="#multilock" class="hash-link">#</a></h2> <p>As of version 3.3.0, a <code>MultiLock</code> is available. It is a lock that can be used to synchronize multiple locks at once.</p> <pre><code class="language-dart">var lock1 = Lock(); var lock2 = Lock(); var multiLock = MultiLock(locks: [lock1, lock2]); multiLock.synchronized(() async { // lock1 and lock2 are locked at this point ... }); </code></pre> <h2 id="features-and-bugs" class="hash-header">Features and bugs <a href="#features-and-bugs" class="hash-link">#</a></h2> <p>Please feel free to:</p> <ul> <li>file feature requests and bugs at the <a href="https://github.com/tekartik/synchronized.dart/issues" rel="ugc">issue tracker</a></li> <li>or <a href="https://tekartik-info.web.app/contact" rel="ugc">contact me</a></li> <li>or visit <a href="https://www.tekartik.com" rel="ugc">tekartik.com</a></li> <li><a href="https://github.com/tekartik/synchronized.dart/blob/master/synchronized/doc/how_to.md" rel="ugc">How to</a> guide</li> </ul> </section></div></div></div><aside class="detail-info-box"><a class="packages-scores" href="/packages/synchronized/score"><div class="packages-score packages-score-like"><div class="packages-score-value -has-value"><span class="packages-score-value-number">565</span><span class="packages-score-value-sign"></span></div><div class="packages-score-label">likes</div></div><div class="packages-score packages-score-health"><div class="packages-score-value -has-value"><span class="packages-score-value-number">160</span><span class="packages-score-value-sign"></span></div><div class="packages-score-label">points</div></div><div class="packages-score packages-score-downloads" title="Number of downloads of this package during the past 30 days"><div class="packages-score-value -has-value"><span class="packages-score-value-number">857k</span><span class="packages-score-value-sign"></span></div><div class="packages-score-label">downloads</div></div></a><h3 class="title">Publisher</h3><p><a href="/publishers/tekartik.com"><img class="-pub-publisher-shield filter-invert-on-dark" src="/static/hash-mh7qv2oc/img/material-icon-verified.svg" alt="verified publisher" width="14" height="14" title="Published by a pub.dev verified publisher"/>tekartik.com</a></p><h3 class="title">Weekly Downloads</h3><div id="-weekly-downloads-sparkline" class="weekly-downloads-sparkline" data-widget="weekly-sparkline" data-weekly-sparkline-points="gEPjZyM5AwAXAAMA3B0DAPmzAgDrmQIABH0CAFqAAQAxSAEAwlIBAIlvAQB0egEA9VUBACuuAABUAgEAlaABABGeAQAIdQEAGqIBAIWWAQCTwgEAToIBABucAQCY4QEAmrIBAJzpAQDrKQIAPiMCAJmzAgCoUAMAQRQDAHO2AgDqpAIAkNcBADW3AQCA3wEARdoBAKXUAQAHqgEAXM4BAGHZAQBDzwEAVcUBAKjNAQBPuAEAe+oBADXqAQCC8QEAitEBAM0ZAgCk+QEAOCoCAHZRAgA="></div><h3 class="title pkg-infobox-metadata">Metadata</h3><p>Lock mechanism to prevent concurrent access to asynchronous code.</p><p><a class="link" href="https://github.com/tekartik/synchronized.dart/tree/master/synchronized" rel="ugc">Repository (GitHub)</a><br/></p><h3 class="title">Topics</h3><p><a class="topics-tag" href="/packages?q=topic%3Amutex" rel="nofollow">#mutex</a> <a class="topics-tag" href="/packages?q=topic%3Alock" rel="nofollow">#lock</a> <a class="topics-tag" href="/packages?q=topic%3Aasync" rel="nofollow">#async</a> <a class="topics-tag" href="/packages?q=topic%3Aconcurrency" rel="nofollow">#concurrency</a></p><h3 class="title">Documentation</h3><p><a class="link" href="/documentation/synchronized/latest/">API reference</a><br/></p><h3 class="title">Funding</h3><p>Consider supporting this project:<br/><br/><a class="link" href="https://github.com/sponsors/alextekartik" rel="ugc">github.com</a><br/></p><h3 class="title">License</h3><p><img class="inline-icon-img filter-invert-on-dark" src="/static/hash-mh7qv2oc/img/material-icon-balance.svg" alt="" width="14" height="14" role="presentation"/>MIT (<a href="/packages/synchronized/license">license</a>)</p><h3 class="title">More</h3><p><a href="/packages?q=dependency%3Asynchronized" rel="nofollow">Packages that depend on synchronized</a></p></aside></div><script type="application/ld+json">{"@context":"http\u003a\u002f\u002fschema.org","@type":"SoftwareSourceCode","name":"synchronized","version":"3.3.1","description":"synchronized - Lock mechanism to prevent concurrent access to asynchronous code.","url":"https\u003a\u002f\u002fpub.dev\u002fpackages\u002fsynchronized","dateCreated":"2016-10-14T20\u003a20\u003a07.739Z","dateModified":"2025-02-13T08\u003a22\u003a34.073971Z","programmingLanguage":"Dart","image":"https\u003a\u002f\u002fpub.dev\u002fstatic\u002fimg\u002fpub-dev-icon-cover-image.png","license":"https\u003a\u002f\u002fpub.dev\u002fpackages\u002fsynchronized\u002flicense"}</script></div><div class="detail-metadata"><h3 class="detail-metadata-title"><span class="detail-metadata-toggle">←</span> Metadata</h3><div class="detail-info-box"><a class="packages-scores" href="/packages/synchronized/score"><div class="packages-score packages-score-like"><div class="packages-score-value -has-value"><span class="packages-score-value-number">565</span><span class="packages-score-value-sign"></span></div><div class="packages-score-label">likes</div></div><div class="packages-score packages-score-health"><div class="packages-score-value -has-value"><span class="packages-score-value-number">160</span><span class="packages-score-value-sign"></span></div><div class="packages-score-label">points</div></div><div class="packages-score packages-score-downloads" title="Number of downloads of this package during the past 30 days"><div class="packages-score-value -has-value"><span class="packages-score-value-number">857k</span><span class="packages-score-value-sign"></span></div><div class="packages-score-label">downloads</div></div></a><h3 class="title">Publisher</h3><p><a href="/publishers/tekartik.com"><img class="-pub-publisher-shield filter-invert-on-dark" src="/static/hash-mh7qv2oc/img/material-icon-verified.svg" alt="verified publisher" width="14" height="14" title="Published by a pub.dev verified publisher"/>tekartik.com</a></p><h3 class="title">Weekly Downloads</h3><div id="-weekly-downloads-sparkline" class="weekly-downloads-sparkline" data-widget="weekly-sparkline" data-weekly-sparkline-points="gEPjZyM5AwAXAAMA3B0DAPmzAgDrmQIABH0CAFqAAQAxSAEAwlIBAIlvAQB0egEA9VUBACuuAABUAgEAlaABABGeAQAIdQEAGqIBAIWWAQCTwgEAToIBABucAQCY4QEAmrIBAJzpAQDrKQIAPiMCAJmzAgCoUAMAQRQDAHO2AgDqpAIAkNcBADW3AQCA3wEARdoBAKXUAQAHqgEAXM4BAGHZAQBDzwEAVcUBAKjNAQBPuAEAe+oBADXqAQCC8QEAitEBAM0ZAgCk+QEAOCoCAHZRAgA="></div><h3 class="title pkg-infobox-metadata">Metadata</h3><p>Lock mechanism to prevent concurrent access to asynchronous code.</p><p><a class="link" href="https://github.com/tekartik/synchronized.dart/tree/master/synchronized" rel="ugc">Repository (GitHub)</a><br/></p><h3 class="title">Topics</h3><p><a class="topics-tag" href="/packages?q=topic%3Amutex" rel="nofollow">#mutex</a> <a class="topics-tag" href="/packages?q=topic%3Alock" rel="nofollow">#lock</a> <a class="topics-tag" href="/packages?q=topic%3Aasync" rel="nofollow">#async</a> <a class="topics-tag" href="/packages?q=topic%3Aconcurrency" rel="nofollow">#concurrency</a></p><h3 class="title">Documentation</h3><p><a class="link" href="/documentation/synchronized/latest/">API reference</a><br/></p><h3 class="title">Funding</h3><p>Consider supporting this project:<br/><br/><a class="link" href="https://github.com/sponsors/alextekartik" rel="ugc">github.com</a><br/></p><h3 class="title">License</h3><p><img class="inline-icon-img filter-invert-on-dark" src="/static/hash-mh7qv2oc/img/material-icon-balance.svg" alt="" width="14" height="14" role="presentation"/>MIT (<a href="/packages/synchronized/license">license</a>)</p><h3 class="title">More</h3><p><a href="/packages?q=dependency%3Asynchronized" rel="nofollow">Packages that depend on synchronized</a></p></div><p class="detail-lead-back"><a class="detail-metadata-toggle">Back</a></p></div><div id="-screenshot-carousel" class="carousel"><fab id="-carousel-prev" class="mdc-fab carousel-prev carousel-nav" data-mdc-auto-init="MDCRipple" title="Previous" data-ga-click-event="screenshot-carousel-prev-click" tabindex="0"><div class="mdc-fab__ripple"></div><img class="mdc-fab__icon" src="/static/hash-mh7qv2oc/img/keyboard_arrow_left.svg" alt="previous" width="24" height="24" aria-hidden="true"/></fab><div id="-image-container" class="image-container"></div><fab id="-carousel-next" class="mdc-fab carousel-next carousel-nav" data-mdc-auto-init="MDCRipple" title="Next" data-ga-click-event="screenshot-carousel-next-click" tabindex="0"><div class="mdc-fab__ripple"></div><img class="mdc-fab__icon" src="/static/hash-mh7qv2oc/img/keyboard_arrow_right.svg" alt="next" width="24" height="24" aria-hidden="true"/></fab><p id="-screenshot-description" class="screenshot-description"></p></div></main><footer class="site-footer"><a class="link" href="https://dart.dev/">Dart language</a><a class="link sep" href="/report?subject=package%3Asynchronized&url=https%3A%2F%2Fpub.dev%2Fpackages%2Fsynchronized">Report package</a><a class="link sep" href="/policy">Policy</a><a class="link sep" href="https://www.google.com/intl/en/policies/terms/">Terms</a><a class="link sep" href="https://developers.google.com/terms/">API Terms</a><a class="link sep" href="/security">Security</a><a class="link sep" href="https://www.google.com/intl/en/policies/privacy/">Privacy</a><a class="link sep" href="/help">Help</a><a class="link icon sep" href="/feed.atom"><img class="inline-icon" src="/static/hash-mh7qv2oc/img/rss-feed-icon.svg" alt="RSS" width="20" height="20" title="RSS/atom feed"/></a><a class="link icon github_issue" href="https://github.com/dart-lang/pub-dev/issues/new"><img class="inline-icon" src="/static/hash-mh7qv2oc/img/bug-report-white-96px.png" alt="bug report" width="20" height="20" title="Report an issue with this site"/></a></footer><script src="/static/hash-mh7qv2oc/highlight/highlight-with-init.js" defer="defer"></script></body></html>