async_tools 0.1.11
async_tools: ^0.1.11 copied to clipboard
Useful data structures and tools for async/Future code
Collection of useful tools for async/Future code in Dart #
Tests are not complete.
Mutex is extended and borrowed from the Mutex package.
Contents: #
- asyncSleep - Simple 'sleep' abstraction to pause a task.
- AsyncTagLock - Lock access to a resource based on an object instance.
- AsyncValue - Like riverpod's AsyncValue, but without Riverpod. Can represent 'data', 'loading', and 'error' states for a value generated asynchronously.
- DelayedWaitSet - Execute a set of async closures starting at the same time, and wait for them all to finish.
- FutureCancellable - Wrapper for
Future<>that simplifies using aCompleterto cancel a future. Allows you to cancel a running future and optionally replace its return value asynchronously. - MutableInner - Implementation of the 'mutable inner' pattern. Exposes internal interfaces with an async critical section 'operate' method to control concurrent access.
- Mutex - Enhanced asynchronous mutex with deadlock detection and debugging built in.
- serialFuture - Process a single future at a time in the background per tag. Queues the future invocations serially and executes them in order.
- singleFuture - Process a single future at a time in the background per tag. Drop future invocations that are invoked while another is in-flight.
- SingleStateProcessor - Process a single state update at a time ensuring the most recent state gets processed asynchronously, possibly skipping states that happen while a previous state is still being processed. Support pause and resume of updates.
- SingleStateProcessorMap - A map-like data structure that manages continuous single-state updates for a set of keys. Useful for reactive programming when you want to incorporate state from many sources in a granular fashion and only rebuild parts you need to. Support pause and resume of updates.
- SingleStatelessProcessor - Process a single stateless update at a time ensuring each request gets processed asynchronously, and continuously while update is requested.
- WaitSet - Execute a set of async closures and wait for them to all to finish.