ilkersevim_async_utils 0.1.1 copy "ilkersevim_async_utils: ^0.1.1" to clipboard
ilkersevim_async_utils: ^0.1.1 copied to clipboard

Small dependency-free Dart guards for coalescing concurrent work and rejecting stale async completions.

ilkersevim_async_utils #

Dependency-free Dart guards for coalescing concurrent async work and rejecting stale async completions.

License: Apache-2.0. Package: pub.dev/packages/ilkersevim_async_utils. Issues: github.com/redjadet/ilkersevim_async_utils/issues.

Installation #

dependencies:
  ilkersevim_async_utils: ^0.1.0

InFlightCoalescer #

One instance shares a single in-flight Future<void>. Concurrent callers await the same future. Success or failure clears the gate so the next call starts fresh.

final InFlightCoalescer coalescer = InFlightCoalescer();
Future<void> refresh() => coalescer.run(() => _doRefresh());

KeyedInFlightCoalescer #

Same idea, one in-flight future per key. Different keys run concurrently.

final KeyedInFlightCoalescer<String> coalescer =
    KeyedInFlightCoalescer<String>();
Future<void> refreshQuery(String query) =>
    coalescer.run(query, () => _doRefreshAndCache(query));

RequestIdGuard #

Ignore stale async completions (request-id pattern).

final RequestIdGuard guard = RequestIdGuard();
Future<void> load() async {
  final int id = guard.next();
  final result = await repository.fetch();
  if (!guard.isCurrent(id)) return;
  // apply result
}

API stability #

Public type names and method signatures are a semantic-versioned contract. Breaking changes require a major version bump.

Publishing #

Releases are tagged vX.Y.Z matching pubspec.yaml. Automated publishing uses GitHub Actions OIDC with the protected pub.dev Environment (reviewer: redjadet). Configure Pub.dev Admin → Automated publishing for repository redjadet/ilkersevim_async_utils, tag pattern v{{version}}, environment pub.dev.

1
likes
160
points
375
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Small dependency-free Dart guards for coalescing concurrent work and rejecting stale async completions.

Repository (GitHub)
View/report issues

Topics

#async #concurrency #dart

License

Apache-2.0 (license)

More

Packages that depend on ilkersevim_async_utils