Skip to content
pubscout

sync

0.3.0, released 6 years ago by an unverified publisher

A Dart library providing Go‑style synchronization primitives for async code.

WASM-ready
$ flutter pub add sync
Source repository

What it does

It offers Mutex, ReadWriteMutex, Semaphore and WaitGroup to coordinate concurrent asynchronous operations. The API is straightforward and fully null‑safe.

AI-written summary of version 0.3.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to protect shared state across async tasks
  • You want to limit the number of concurrent operations
  • You need to wait for a group of async tasks to finish

Skip it when

  • Your app is single‑threaded or you already use a higher‑level state management solution
  • You require more advanced concurrency features like condition variables or channels

Strengths

  • Simple, well‑documented API
  • No external dependencies
  • Null‑safe and works on all platforms

Weaknesses

  • Limited to basic primitives, no advanced sync features
  • No built‑in support for condition variables or async queues

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0
```dart
import 'package:sync/sync.dart';

final mutex = Mutex();

Future<void> safeIncrement() async {
  await mutex.acquire();
  try {
    // modify shared state
  } finally {
    mutex.release();
  }
}
```

Alternatives

Packages that do the same job and could replace sync.

  • secretary

    A Dart library for managing queues of asynchronous tasks with validation, retries and event streams.

  • structured_async

    Structured asynchronous programming and cancellable futures for Dart.