isComposite property
bool
get
isComposite
Indicates whether this pulse is a multi-message bundle (a collection).
When to use
- Bundle Detection: Check this before iterating over a pulse to determine if it contains a single signal or a collection of signals.
- Conditional Logic: Use this to branch logic based on whether a receptor is receiving an atomic update or a batch of updates.
How it works
A pulse is considered composite only when it acts as a container for other pulses. This occurs through:
- Binary Composition: Using the
+operator. - Flat Aggregation: Using the Pulse.batch factory or
.batch()extension. - Explicit Evolution: Calling evolve while passing a new Pulse.
Example
final p1 = Pulse(1).withStep('validated');
print(p1.isComposite); // false (still one signal)
final p2 = Pulse(2);
final bundle = p1 + p2;
print(bundle.isComposite); // true (contains two signals)
Implementation
bool get isComposite;