Flow class abstract Features Architecture Walkthroughs Demo · ICU Alarm Pipeline Demo · Pharmacy Transactions Demo · Search Stability Demo · Forensic Pipeline HowTo-FlowInstructions Method Chaining (Fluent)

The Transcription Orchestrator for the Cell framework, responsible for converting (transcribing) external stimuli, persistent state, and logic into reactive Cell topographies.

Flow acts as the Administrative Facade over the Mitosis reactive layer. It provides a declarative, static API for building complex reactive pipelines without manually instantiating FlowInstruction or Receptor objects.

When to use

Use Flow as your primary entry point for reactive orchestration:

  • Pipeline Creation: Bridging external Futures or Streams into cells.
  • Synchronous Logic: Applying filters, maps, and scans.
  • Asynchronous Coordination: Managing concurrency with switchMap, mergeMap, and asyncMap.
  • Temporal Control: Implementing debounce, throttle, and delay logic.
  • Topological Routing: Branching or partitioning signals through the graph.

How it works

  1. Every static method in Flow acts as a factory for a specific FlowInstruction.
  2. When called, the method creates the instruction, binds it to the provided source cell, and materializes a FlowHandle.
  3. The FlowHandle provides access to the output .cell and an .emit() mechanism, while managing the underlying receptor lifecycle.
  4. Transformations are optimized into flyweight receptors that execute within the host cell's switching fabric.

See Also:

  • FlowInstruction: The stateless blueprint for reactive logic.
  • FlowHandle: The live instance of a flow pipeline.
  • Cell: The underlying stateful node in the reactive graph. A namespace of static operator factories. Flow is deliberately NOT a CellBase: it has no cell state, no nucleus, and no participation in the reactive graph — it only assembles FlowInstruction blueprints. Keeping it out of the cell hierarchy prevents a fake cell from leaking into cell-typed positions.

AI Agent Guide

Layer: Flow — the static operator catalog. Not a Cell factory, not a Tissue book. When to use: walk §3 families of HowTo-Mitose-Flow.md against the BRD before writing a custom instruction; Flow.* covers feed adapters and adjacent journeys. When NOT to use: the decision gate of a Cell-variant Demo — that is FlowInstructionBase + + + toHandle (one Receptor, one lock). Live signature: abstract class Flow — static factories return FlowHandle — pinned at cell_flow: 1.0.0 Do NOT confuse with: Cell (graph nodes; Flow is a namespace that only assembles blueprints). Guide: HowTo-Mitose-Flow.md §3 "Examine the catalog against the BRD" (#flow-catalog) Example: example/cell_flow_example.dart Cross-layer: entry is Cell.ingress; books are cell_tissue; Cell.observe glues them. Minimal compilable example

final src = Cell.ingress<int>();
final h = Flow.filter<int>(src.cell, test: (v) => v > 0);
final o = Cell.observe(source: h.cell, effect: (Pulse p) => print(p.payload));
src.emit(1);
o.stop();

Constructors

Flow()

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

Static Methods

asyncExpand<S, T>(Cell source, {required FutureOr<Object?> expand(S value), ExpandErrorHandler? onError}) → FlowHandle
Flatten an inner sequence per payload (Dart asyncExpand).
asyncExpandConcurrent<S, T>(Cell source, {required FutureOr<Object?> expand(S value), ExpandErrorHandler? onError}) → FlowHandle
Concurrent flatten.
asyncExpandExhaust<S, T>(Cell source, {required FutureOr<Object?> expand(S value), ExpandErrorHandler? onError}) → FlowHandle
Exhaust flatten — ignore while busy.
asyncExpandLatest<S, T>(Cell source, {required FutureOr<Object?> expand(S value), ExpandErrorHandler? onError}) → FlowHandle
Switch flatten — drop the previous inner.
asyncFold<S, A>(Cell source, {required A seed, required FutureOr<A> accumulate(A acc, S value), FoldSnapshot<A>? snapshot, FoldErrorHandler? onError}) → FlowHandle
Async running fold (queued).
asyncFoldExhaust<S, A>(Cell source, {required A seed, required FutureOr<A> accumulate(A acc, S value), FoldSnapshot<A>? snapshot, FoldErrorHandler? onError}) → FlowHandle
Similar to asyncFold, but ignores new triggers while an inner accumulation is already running.
asyncFoldLatest<S, A>(Cell source, {required A seed, required FutureOr<A> accumulate(A acc, S value), FoldSnapshot<A>? snapshot, FoldErrorHandler? onError}) → FlowHandle
Similar to asyncFold, but only processes the latest pulse.
asyncMap<S, T>(Cell source, {required FutureOr<T> mapper(S value), AsyncMapErrorHandler? onError}) → FlowHandle
Maps each payload through an asynchronous mapper.
asyncMapConcurrent<S, T>(Cell source, {required FutureOr<T> mapper(S value), AsyncMapErrorHandler? onError}) → FlowHandle
Similar to asyncMap, but processes pulses concurrently as they arrive.
asyncMapLatest<S, T>(Cell source, {required FutureOr<T> mapper(S value), AsyncMapErrorHandler? onError}) → FlowHandle
Similar to asyncMap, but only processes the latest pulse.
asyncMapWithFallback<S, T>(Cell source, {required FutureOr<T> mapper(S value), required T fallback, AsyncMapErrorHandler? onError}) → FlowHandle
Emit fallback when the mapper throws.
asyncMapWithIndex<S, T>(Cell source, {required FutureOr<T> mapper(S value, int index), AsyncMapErrorHandler? onError}) → FlowHandle
Async map with a 0-based index.
asyncMapWithRetry<S, T>(Cell source, {required FutureOr<T> mapper(S value), int count = 3, AsyncMapErrorHandler? onError}) → FlowHandle
Retry the mapper up to count extra times.
asyncMapWithTimeout<S, T>(Cell source, {required FutureOr<T> mapper(S value), required Duration duration, AsyncMapErrorHandler? onError}) → FlowHandle
Time-box one projection.
asyncReduce<S>(Cell source, {required FutureOr<S> accumulate(S acc, S value), FoldErrorHandler? onError}) → FlowHandle
First value is the seed; later values accumulate.
audit<S>(Cell source, {required Cell notifier, SampleErrorHandler? onError}) → FlowHandle
After a source value, emit it on the next notifier pulse.
auditTime<S>(Cell source, {required Duration duration, SampleErrorHandler? onError}) → FlowHandle
Emit the latest value duration after a source move.
bufferCount<S>(Cell source, {required int size, int? skip, BufferErrorHandler? onError}) → FlowHandle
Collects payloads into a list and emits it once it reaches size (Rx bufferCount).
bufferTime<S>(Cell source, {required Duration duration, bool emitEmpty = false, BufferErrorHandler? onError}) → FlowHandle
Periodically flushes the collected payloads into a list and emits it (Rx bufferTime).
bufferWhen<S>(Cell source, {required Cell closer, bool emitEmpty = false, BufferErrorHandler? onError}) → FlowHandle
Flush when closer pulses.
bufferWithPredicate<S>(Cell source, {required bool test(S value), bool includeTrigger = true, BufferErrorHandler? onError}) → FlowHandle
Close the buffer when test is true.
bufferWithTimeAndCount<S>(Cell source, {required Duration duration, required int count, bool emitEmpty = false, BufferErrorHandler? onError}) → FlowHandle
Flush on count or duration.
combineLatestWith<S, R>(Cell source, {required List<Cell> others, required R combine(S sourceValue, List<Object?> latest), CombineErrorHandler? onError}) → FlowHandle
Combines the latest value from source with the latest values from others whenever any of them emit.
concat<T>(Cell source, {required Iterable<Object?> inners, ConcatErrorHandler? onError}) → FlowHandle
Play static inners after the first pulse (Rx concat).
concatAll<T>(Cell source) → FlowHandle
Each payload is an inner, queued (Rx concatAll).
concatLatest<T>(Cell source) → FlowHandle
Last item of each inner.
concatMap<S, T>(Cell source, {required FutureOr<Object?> project(S value)}) → FlowHandle
Maps each payload to an inner sequence and flattens them sequentially (Rx concatMap).
debounce<S>(Cell source, {required Duration duration}) → FlowHandle
Delays the emission of pulses until duration has passed since the last pulse (Rx debounce).
deferFuture<S>(Cell source, {required Future<S> create(Pulse trigger), FutureErrorHandler? onError, bool emitErrorPulse = true}) → FlowHandle
Executes create to start a new future on every pulse received from source (Rx defer for futures).
deferStream<S>(Cell source, {required Stream<S> create(), StreamErrorHandler? onError, bool emitErrorPulse = true}) → FlowHandle
Executes create to subscribe to a new stream on every pulse received from source (Rx defer for streams).
delay<S>(Cell source, {required Duration duration, DelayErrorHandler? onError}) → FlowHandle
Shift every value by duration (Rx delay).
delayLatest<S>(Cell source, {required Duration duration, DelayErrorHandler? onError}) → FlowHandle
Only the latest value after duration (trailing delay).
delayWhen<S>(Cell source, {required FutureOr<Object?> when(S value), DelayErrorHandler? onError}) → FlowHandle
Wait for when before forwarding (Rx delayWhen).
delayWithSelector<S>(Cell source, {required Duration durationOf(S value), DelayErrorHandler? onError}) → FlowHandle
Per-value delay.
distinct<S>(Cell source) → FlowHandle
Suppresses pulses that have been seen before (globally or consecutively depending on configuration).
exhaustMap<S, T>(Cell source, {required FutureOr<Object?> project(S value)}) → FlowHandle
Maps each payload to an inner sequence, but ignores new ones while a sequence is already active (Rx exhaustMap).
filter<S>(Cell source, {required bool test(S value)}) → FlowHandle
Only forwards payloads that satisfy the test predicate (Rx filter).
fromFuture<S>(Cell source, {required Future<S> future, Duration? timeout, FutureErrorHandler? onError, bool emitErrorPulse = true}) → FlowHandle
Bridges a single future into the graph on the first pulse received from source (Rx fromFuture).
fromIterable<T>(Cell source, {required Iterable<T> iterable}) → FlowHandle
Emits each element of iterable on the first pulse received from source (Rx from).
fromStream<S>(Cell source, {required Stream<S> stream, StreamErrorHandler? onError, bool emitErrorPulse = true}) → FlowHandle
Subscribes to stream on the first pulse received from source (Rx fromStream).
groupBy<S, K>(Cell source, {required K keyOf(S value), GroupErrorHandler? onError}) → FlowHandle
Tag each value with keyOf (Rx groupBy flattened).
groupByCount<S, K>(Cell source, {required K keyOf(S value), required int size, GroupErrorHandler? onError}) → FlowHandle
Emit a group's list when it hits size.
groupCollect<S, K>(Cell source, {required K keyOf(S value), Map<K, List<S>>? groups, GroupErrorHandler? onError}) → FlowHandle
Running Map<K, List<S>>.
iif<S, T>(Cell source, {required bool test(S value), required T thenMap(S value), required T elseMap(S value)}) → FlowHandle
A binary router that chooses between thenMap and elseMap based on test (Rx iif).
interval(Cell source, {required Duration period}) → FlowHandle
Periodic ticks after the first pulse.
map<S, T>(Cell source, {required T project(S value), MapErrorHandler? onError}) → FlowHandle
Projects each incoming payload through the project function (Rx map).
mapKeys<K, V, R>(Cell source, {required R project(K key), MapErrorHandler? onError}) → FlowHandle
Payload is a Map; project each key.
mapNotNull<S, T>(Cell source, {required T? project(S value), MapErrorHandler? onError}) → FlowHandle
Projects each payload and suppresses the pulse if the result is null.
mapTo<S, T>(Cell source, {required T value, MapErrorHandler? onError}) → FlowHandle
Emits the constant value for every pulse received from source (Rx mapTo).
mapValue<S, T>(Cell source, {required T project(S value), MapErrorHandler? onError}) → FlowHandle
Alias of map using the MapValue name.
mapValueIf<S, T>(Cell source, {required bool test(S value), required T project(S value), MapErrorHandler? onError}) → FlowHandle
MapWhen under the MapValue name.
mapValueOr<S, T>(Cell source, {required T project(S value), required T orElse(S value, Object error), MapErrorHandler? onError}) → FlowHandle
Project, or orElse when project throws.
mapValues<K, V, R>(Cell source, {required R project(V value), MapErrorHandler? onError}) → FlowHandle
Payload is a Map; project each value.
mapWhen<S, T>(Cell source, {required bool test(S value), required T project(S value), MapErrorHandler? onError}) → FlowHandle
Project only when test is true.
mapWithIndex<S, T>(Cell source, {required T project(S value, int index), MapErrorHandler? onError}) → FlowHandle
Projects each payload along with its 0-based index.
merge<T>(Cell source, {required List<Cell> sources}) → FlowHandle
Merge extra sources; source only arms future.
mergeAll<T>(Cell source, {MergeErrorHandler? onError}) → FlowHandle
Payload is an inner to merge (Rx mergeAll).
mergeMap<S, T>(Cell source, {required FutureOr<Object?> project(S value)}) → FlowHandle
Maps each payload to an inner sequence and flattens them concurrently (Rx mergeMap).
mergeWith<T>(Cell source, {required List<Cell> others}) → FlowHandle
Forward source and others (Rx mergeWith).
of<T>(Cell source, {required Iterable<T> values}) → FlowHandle
Emits each value in values sequentially on the first pulse received from source (Rx of).
pairwise<S>(Cell source) → FlowHandle
Emits a tuple of the (previous, current) payloads for every pulse after the first.
partition<S>(Cell source, {required bool test(S value), PartitionErrorHandler? onError}) → FlowHandle
Routes pulses based on whether they satisfy the test predicate.
partitionMap<S, T>(Cell source, {required bool test(S value), required T thenMap(S value), required T elseMap(S value), PartitionErrorHandler? onError}) → FlowHandle
Map matched / unmatched with different projectors.
partitionOnly<S>(Cell source, {required bool test(S value), bool matched = true, PartitionErrorHandler? onError}) → FlowHandle
Keep only the matching side.
pluck<T>(Cell source, {required Object key, PluckErrorHandler? onError}) → FlowHandle
Extracts the value at key from a Map payload (Rx pluck).
pluckAll(Cell source, {required Iterable<Object> keys, Object? orElse, bool useOrElse = false, PluckErrorHandler? onError}) → FlowHandle
Pluck several keys into a Map.
pluckOr<T>(Cell source, {required Object key, required T orElse, PluckErrorHandler? onError}) → FlowHandle
Pluck with orElse when the field is missing.
pluckPath<T>(Cell source, {required Iterable<Object> path, T? orElse, bool useOrElse = false, PluckErrorHandler? onError}) → FlowHandle
Walk a nested path.
race<T>(Cell source, {required List<Object?> competitors}) → FlowHandle
First inner to emit wins (Rx race).
range(Cell source, {required int start, required int count, int step = 1}) → FlowHandle
Emits a range of count integers starting from start on the first pulse received from source (Rx range).
reduce<S, A>(Cell source, {required A seed, required A accumulate(A acc, S value)}) → FlowHandle
Similar to scan, but uses an explicit seed value to initialize the accumulator.
repeat<T>(Cell source, {required T value, int count = 1}) → FlowHandle
Emits the same value, count times, on the first pulse received from source.
retry<S, T>(Cell source, {required RetryTask<S, T> task, int count = 3, RetryErrorHandler? onError, bool emitErrorPulse = true}) → FlowHandle
Retry a failing inner.
sample<S>(Cell source, {required Cell notifier, SampleErrorHandler? onError}) → FlowHandle
Latest source value when notifier pulses.
sampleTime<S>(Cell source, {required Duration period, SampleErrorHandler? onError}) → FlowHandle
Latest source value every period.
scan<S, A>(Cell source, {required A accumulate(A acc, S value)}) → FlowHandle
Applies an accumulate function over the pulses, emitting each intermediate result (Rx scan).
share<S>(Cell source) → FlowHandle
Multicasts the same pulses to all observers (Rx share).
shareReplay<S>(Cell source, {int size = 1}) → FlowHandle
Share with a replay buffer.
skip<S>(Cell source, {required int count}) → FlowHandle
Suppresses the first count pulses received from source.
skipRepeated<S>(Cell source) → FlowHandle
Suppresses pulses if their payload is identical to the previous payload.
skipUntil<S>(Cell source, {required Cell notifier}) → FlowHandle
Skip until notifier pulses.
skipWhen<S>(Cell source, {required bool test(S value)}) → FlowHandle
Drop values while test is true.
skipWhile<S>(Cell source, {required bool test(S value)}) → FlowHandle
Skip while test is true.
startWith<S>(Cell source, {required S value, bool replaceFirst = false}) → FlowHandle
Prepends the given value to the sequence before any pulses from source are emitted (Rx startWith).
switchMap<S, T>(Cell source, {required FutureOr<Object?> project(S value)}) → FlowHandle
Maps each payload to an inner sequence and always switches to the latest one (Rx switchMap).
take<S>(Cell source, {required int count}) → FlowHandle
Only forwards the first count pulses received from source.
takeUntil<S>(Cell source, {required Cell notifier}) → FlowHandle
Take until notifier pulses.
takeWhile<S>(Cell source, {required bool test(S value)}) → FlowHandle
Take while test is true.
tap<S>(Cell source, {required void onValue(S value), TapErrorHandler? onError}) → FlowHandle
Executes a side effect onValue for every pulse without modifying the sequence (Rx tap).
tapAll(Cell source, {required void onPulse(Pulse pulse), TapErrorHandler? onError}) → FlowHandle
Tap every pulse, including wrong types.
tapWithIndex<S>(Cell source, {required void onValue(S value, int index), TapErrorHandler? onError}) → FlowHandle
Tap with a 0-based index.
throttle<S>(Cell source, {required Duration duration, bool leading = true, bool trailing = false}) → FlowHandle
Limits the rate of emissions by enforcing a silent window of duration after a pulse.
timeout<S>(Cell source, {required Duration duration, TimeoutErrorHandler? onError, bool emitErrorPulse = true}) → FlowHandle
Idle timeout after the last pulse.
timeoutWithFallback<S>(Cell source, {required Duration duration, required S fallback, bool once = false}) → FlowHandle
Timeout with a fallback value.
windowCount<S>(Cell source, {required int size, int? skip}) → FlowHandle
Window by count (list payload).
windowTime<S>(Cell source, {required Duration duration}) → FlowHandle
Window by time.
withLatestFrom<S, R>(Cell source, {required List<Cell> others, required R combine(S sourceValue, List<Object?> latest), CombineErrorHandler? onError}) → FlowHandle
Combines the latest value from source with the latest values from others only when source emits (Rx withLatestFrom).
zip<R>(Cell source, {required List<Cell> sources, R project(List<Object?> row)?, ZipErrorHandler? onError}) → FlowHandle
Zip extra sources; source arms future.
zipAll<T>(Cell source, {required int width, ZipErrorHandler? onError}) → FlowHandle
Pack width source values into a list.
zipWith<R>(Cell source, {required List<Cell> others, R project(List<Object?> row)?, ZipErrorHandler? onError}) → FlowHandle
Zip source with others by index (Rx zipWith).