Async<C> class abstract

A foundational marker interface and architectural contract representing an Asynchronous Proxy or Controller for a core component C.

In the reactive fabric, Async serves as the primary Concurrency Bridge, providing a thread-safe, Future-based gateway between the synchronous reactive domain and the asynchronous environment (such as the Dart Event Loop or background execution tiers).

When to use

  • Contextual Transition: When you need to interact with synchronous nodes (like Cell or Box) from within async functions or external event handlers.
  • Concurrency Safety: To ensure that state inspection or mutation does not interfere with a "Reactive Wave" currently in progress.
  • External Drivers: When updating reactive state from non-reactive sources, such as network sockets, timers, or user input events.

How it works

  1. Temporal Serialization: Implementations typically wrap the principal component C using a synchronization Lock. This ensures that "Out-of-Band" asynchronous requests are queued until the synchronous graph stabilizes.
  2. Logical Linking: Establishes a strict 1:1 coupling with a synchronous principal. For every Async<C>, there is exactly one underlying instance of type C that holds the actual state and logic.
  3. Non-Blocking Orchestration: Unlike the synchronous principal which requires immediate availability, the Async handle utilizes Future semantics to await authority, providing a resilient developer experience under high contention.

Example

// A synchronous ValueCell (The Principal)
final count = ValueCell<int>(state: 0);

// Its asynchronous handle (The Proxy)
final Async<ValueCell<int>> controller = count.async;

void performSafeUpdate() async {
  // The async handle ensures we wait for graph stability before reading
  final current = await (controller as ValueCellAsync<int>).state;
  print('Atomic state: $current');
}

Type Parameters:

  • C: The Principal Identity. The type of the core framework component (usually a subtype of Cell or Box) being managed by this proxy.

See Also:

  • Lock: The underlying primitive used to serialize access.
  • Cell.async: The standard entry point for obtaining an async handle.
  • Unmodifiable: For a different type of proxy focused on read-only access.

Constructors

Async()

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited