Pulse<P> class abstract interface

A reactive signal — the fundamental unit of communication in the framework.

A Pulse is an immutable message that carries data, provenance, and governance metadata through the reactive graph. It's the signal that cells emit and observe — the "currency" of the switching fabric.

When to use

  • Communication: Most of the time, you don't create pulses directly. Cells do it for you:
  • Manual Injection: When you do need to create one, use the simple factory:
final pulse = Pulse('Hello, World!');

What a pulse carries

  • payload: the actual data (the signal's content).
  • type: a semantic classification for routing and filtering. It is commonly a String tag, but may be any object (such as an enum).
  • priority: urgency (0‑100, higher = more urgent).
  • context: provenance — who sent it, why, with what clearance.
  • trace: a breadcrumb trail of transformations.
  • policy: lifecycle constraints (TTL, hop limit).

How it works

Pulses are immutable — you can't change one. To "update" a pulse, you evolve it, creating a new pulse that links back to the original. This is how the framework preserves causal history without duplicating data.

Non‑obvious: a pulse is governed if it has a Context or Policy

A pulse is considered isGoverned if it was created with a non‑default PulseContext and/or a PulseEphemeralPolicy. This triggers additional validation, lifecycle management, and auditing behaviours during propagation.

Non‑obvious: pulses are flyweights

The framework uses a flyweight pattern internally. An evolved pulse doesn't copy its parent's payload — it inherits it by walking up the parent chain. This means you can have deep causal chains with minimal memory overhead.

Non‑obvious: pulses carry their own governance

A pulse can challenge a receptor before revealing its payload. This is the reciprocal handshake — the pulse and receptor validate each other before any data is exchanged. Use shell to send a pulse to untrusted code.

Example: Creating and Evolving a Pulse

final root = Pulse<int>(42, type: 'counter');
final evolved = root
  .withStep('validation')
  .withStep('transformation');

print(evolved.payload); // 42 (inherited)
print(evolved.trace); // ['validation', 'transformation']
print(evolved.type); // 'counter' (inherited)

See also:

Implemented types
Available extensions

Constructors

Pulse(P? payload, {dynamic type, Cell? source, int? priority, String? step})
Creates a simple, ungoverned pulse.
factory
Pulse.governed({PulseEphemeralPolicy? policy, PulseContext? context, P? payload, String? type, Cell? source, String? step, int? priority, void onComplete(Pulse pulse)?, void onError(Pulse pulse, Object error, {StackTrace? stackTrace})?, void onProgress(Pulse pulse, Cell cell, {String? message})?})
Creates a governed pulse with lifecycle and security metadata.
factory

Properties

context → PulseContext
The operational tier and security authority under which this pulse propagates.
no setter
first → Pulse
The first element.
no setterinherited
hashCode → int
The hash code for this object.
no setterinherited
isComposite → bool
Indicates whether this pulse is a multi-message bundle (a collection).
no setter
isEmpty → bool
Whether this collection has no elements.
no setterinherited
isGoverned → bool
Indicates whether this pulse is subject to explicit governance.
no setter
isInvalidated → bool
Indicates whether this message has reached its terminal lifecycle state.
no setter
isNotEmpty → bool
Whether this collection has at least one element.
no setterinherited
iterator → Iterator<Pulse>
Returns an iterator over the sub‑pulses in this pulse.
no setteroverride
last → Pulse
The last element.
no setterinherited
length → int
The number of elements in this Iterable.
no setterinherited
payload → P?
The primary data or instruction carried by this signal.
no setter
policy → PulseEphemeralPolicy?
The lifecycle governance policy for this pulse.
no setter
priority → int
The execution priority of this pulse (0‑100, higher = more urgent).
no setter
root → Pulse<P>
The primordial ancestor that initiated this pulse's causal lineage.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
shell → PulseShell<P, Receptor<Cell>>
Returns a Defensive Proxy of this pulse for untrusted receivers.
no setter
single → Pulse
Checks that this iterable has only one element, and returns that element.
no setterinherited
source → Cell?
The cell that originally emitted this pulse's lineage.
no setter
timestamp → DateTime
The exact moment this pulse was synthesised.
no setter
trace → List<String>
An ordered sequence of steps documenting the signal's journey.
no setter
type → dynamic
A semantic identifier representing the category or intent of the pulse.
no setter
unmodifiable → Pulse<P>
Returns a read‑only projection of this pulse, ensuring structural and payload-level finality for the current propagation hop.
no setter

Methods

any(bool test(Pulse element)) → bool
Checks whether any element of this iterable satisfies test.
inherited
attach(dynamic context) → Pulse<P>

Available on Pulse<P>, provided by the PulseExtension extension

Returns a new version of this pulse with updated context metadata.
attach(dynamic context) → Iterable<Pulse>

Available on Iterable<Pulse>, provided by the PulseIterableExtension extension

Returns a new collection of pulses, each with the provided context metadata attached.
batch() → Pulse

Available on Iterable<Pulse>, provided by the PulseIterableExtension extension

Aggregates multiple signals into a single, flat CollectivePulse.
cast<R>() → Iterable<R>
A view of this iterable as an iterable of R instances.
inherited
cast<T>() → Pulse<T>

Available on Pulse<P>, provided by the PulseExtension extension

Re-casts the pulse payload to type T while maintaining causal history.
compareTo(Pulse other) → int
Compares this pulse with another to determine relative execution precedence.
override
contains(Object? element) → bool
Whether the collection contains an element equal to element.
inherited
elementAt(int index) → Pulse
Returns the indexth element.
inherited
every(bool test(Pulse element)) → bool
Checks whether every element of this iterable satisfies test.
inherited
evolve({Pulse? pulse, String? step, covariant PulseContext? context}) → Pulse
Creates a derived version of this pulse for the next processing stage.
expand<T>(Iterable<T> toElements(Pulse element)) → Iterable<T>
Expands each element of this Iterable into zero or more elements.
inherited
firstWhere(bool test(Pulse element), {Pulse orElse()?}) → Pulse
The first element that satisfies the given predicate test.
inherited
flatten() → Iterable<Pulse>

Available on Iterable<Pulse>, provided by the PulseIterableExtension extension

Recursively flattens any nested CollectivePulse structures into a sequence of simple pulses.
fold<T>(T initialValue, T combine(T previousValue, Pulse element)) → T
Reduces a collection to a single value by iteratively combining each element of the collection with an existing value
inherited
followedBy(Iterable<Pulse> other) → Iterable<Pulse>
Creates the lazy concatenation of this iterable and other.
inherited
forEach(void action(Pulse element)) → void
Invokes action on each element of this iterable in iteration order.
inherited
join([String separator = ""]) → String
Converts each element to a String and concatenates the strings.
inherited
lastWhere(bool test(Pulse element), {Pulse orElse()?}) → Pulse
The last element that satisfies the given predicate test.
inherited
lineage<T>(LineageArgument arg) → List<T>
Traverses the causal chain from the root ancestor to this pulse to reconstruct a historical timeline of values.
map<T>(T toElement(Pulse e)) → Iterable<T>
The current elements of this iterable modified by toElement.
inherited
map<T>(T mapper(P payload)) → Pulse<T>

Available on Pulse<P>, provided by the PulseExtension extension

Transforms the payload of this pulse into a new type T while preserving its causal history.
mapEach<T>(T mapper(dynamic payload)) → Iterable<Pulse<T>>

Available on Iterable<Pulse>, provided by the PulseIterableExtension extension

Transforms the payload of every pulse in the collection while preserving their individual causal traces.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reduce(Pulse combine(Pulse value, Pulse element)) → Pulse
Reduces a collection to a single value by iteratively combining elements of the collection using the provided function.
inherited
scrutinize(covariant Receptor<Cell> receptor, List? positionalArguments, [Map<Symbol, dynamic>? namedArguments]) → dynamic
Challenges a receptor to prove it has the authority to see this pulse.
singleWhere(bool test(Pulse element), {Pulse orElse()?}) → Pulse
The single element that satisfies test.
inherited
skip(int count) → Iterable<Pulse>
Creates an Iterable that provides all but the first count elements.
inherited
skipWhile(bool test(Pulse element)) → Iterable<Pulse>
Creates an Iterable that skips leading elements while test is satisfied.
inherited
take(int count) → Iterable<Pulse>
Creates a lazy iterable of the count first elements of this iterable.
inherited
takeWhile(bool test(Pulse element)) → Iterable<Pulse>
Creates a lazy iterable of the leading elements satisfying test.
inherited
tap(void action(P payload)) → Pulse<P>

Available on Pulse<P>, provided by the PulseExtension extension

Executes a side-effect action using the current payload and returns this pulse instance.
toList({bool growable = true}) → List<Pulse>
Creates a List containing the elements of this Iterable.
inherited
toSet() → Set<Pulse>
Creates a Set containing the same elements as this iterable.
inherited
toString() → String
A string representation of this object.
inherited
where(bool test(Pulse element)) → Iterable<Pulse>
Creates a new lazy Iterable with all elements that satisfy the predicate test.
inherited
whereType<T>() → Iterable<R>
Creates a new lazy Iterable with all elements that have type T.
inherited
withStep(String step) → Iterable<Pulse>

Available on Iterable<Pulse>, provided by the PulseIterableExtension extension

Appends a diagnostic stage to the causal trace of every pulse in this collection.
withStep(String step) → Pulse<P>
Appends a diagnostic stage to the pulse's causal trace without branching the causal chain.

Operators

operator +(covariant Pulse other) → Pulse
Combines this pulse and other into a composite CollectivePulse.
operator ==(Object other) → bool
The equality operator.
inherited

Static Properties

defaultPriority ↔ int
The default priority for pulses when none is specified.
getter/setter pair

Static Methods

batch<P>(Iterable<Pulse<P>> pulses, {PulseEphemeralPolicy? policy, PulseContext? context, String? type, Cell? source, String? step, int? priority, void onComplete(Pulse pulse)?, void onError(Pulse pulse, Object error, {StackTrace? stackTrace})?, void onProgress(Pulse pulse, Cell cell, {String? message})?}) → Pulse
Creates a collective pulse from an iterable of individual pulses.