A reactive collection that behaves like a normal Dart Iterable but is
fully governed, observable, and thread‑safe – the foundation of all
reactive containers in cell_tissue.
Where to start
You never implement this interface directly. Instead, use one of the concrete subtypes that match your data structure needs:
- TissueList – an ordered, indexable list.
- TissueSet – a unique‑element set.
- TissueMap – a key‑value store.
- TissueQueue – a double‑ended FIFO/LIFO buffer.
- TissueValue – a single, reactive scalar value.
Each subtype provides the full Dart collection API you already know and
love (add, remove, for‑in, map, where, fold, etc.), but every
mutation is automatically validated, emits a reactive event, and is
synchronised through a thread‑safe lock.
When to use
Choose a Tissue collection whenever you need:
- Observability: UI components or other cells that react to changes in the collection.
- Validation: Business rules enforced on every mutation (e.g., positive numbers, non‑empty strings, max size).
- Security: Sharing a collection with read‑only views (unmodifiable) or restricted proxies (deputy) without copying data.
- Concurrency: Thread‑safe updates from multiple isolates or event handlers.
- Auditability: A complete causal trace of every change, with provenance metadata.
How it works
Every Tissue is a Cell that holds two internal parts:
- A Container – the physical storage (e.g., a
List,Set,Map). - A TissueNucleus – an immutable blueprint that defines the collection's validation rules, transformation logic, and propagation behaviour.
When you mutate a tissue (e.g., list.add(42)), the operation:
- Passes through the TestTissue validation gate.
- Is applied atomically to the physical storage under a Lock.
- Emits a TissuePulse (e.g., one classified as Tissue.elementAdded).
- Propagates the event through the collection's Synapses to all downstream observers.
This is the same reactive pipeline you know from Cell, extended to collections.
Example: A validated task list
final tasks = TissueList<Task>(
testRule: TestTissue<Task, TissueList<Task>>(
(task, {host, action, user}) => task.title.isNotEmpty,
),
);
// Observe additions
tasks.listen((event) {
if (event.type == Tissue.elementAdded) {
print('Added: ${event.payload.title}');
}
});
tasks.add(Task('Buy milk')); // passes validation → event fires
tasks.add(Task('')); // rejected by validation → no event
Example: A read‑only view for UI
final source = TissueList<String>(['A', 'B', 'C']);
final readOnly = source.unmodifiable;
// Pass readOnly to a widget – it's safe to read, but cannot be mutated.
source.add('D');
print(readOnly.length); // 4 – the view is live!
See also:
- TissueList, TissueSet, TissueMap, TissueQueue, TissueValue for the concrete collection types.
- TestTissue for custom validation rules.
- TissueReceptor for custom mutation processing.
- TissuePulse for the change events emitted by tissues.
Type Parameters:
E– The type of elements held within the collection.
AI Agent Guide
Layer: Tissue — the governed-book interface. Not a Cell factory, not a Flow operator.
When to use: the shared surface of TissueList / TissueSet / TissueMap / TissueQueue / TissueValue — every book is a Cell under the hood with its own lock and collection pulses.
When NOT to use: as a book directly — pick one of the five concrete types; a plain Dart List is not a book.
Live signature: abstract interface class Tissue<E> implements Cell, Iterable<E> — pinned at cell_tissue: 1.2.0
Do NOT confuse with: Cell (graph node; Tissue adds collection semantics and TestTissue).
Guide: HowTo-Mitose-Tissue.md §2 "Examine all five collections against the BRD" (#tissue-catalog)
Example: example/cell_tissue_example.dart
Cross-layer: entry is Cell.ingress; the decision is cell_flow; only Cell.observe may write books.
Minimal compilable example
final book = TissueList.of([1, 2, 3]);
print(book.map((e) => e * 2).toList()); // [2, 4, 6]
- Implemented types
- Available extensions
Constructors
-
Tissue(Iterable<
E> elements, {Cell? bind, TissueReceptor<E, Tissue< receptor, TestTissue<E> >E, Tissue< testRule, Synapses<E> >Pulse, Cell> synapses}) -
The primary factory for creating a Tissue collection.
factory
-
Tissue.empty({Cell? bind, Context context = Context.system, TissueReceptor<
E, Tissue< receptor = TissueReceptor.passThrough, TestTissue<E> >E, Tissue< testRule = TestTissue.allowAll, Synapses<E> >Pulse, Cell> synapses = Synapses.enabled}) -
Creates an empty Tissue container, initializing a reactive node
with no initial members but a fully established behavioral blueprint.
factory
-
Tissue.fromNucleus(TissueNucleus<
E> nucleus, {Iterable<E> ? elements}) -
Creates a Tissue from a pre‑configured TissueNucleus blueprint.
factory
-
Tissue.governed(Iterable<
E> elements, {EphemeralPolicy<Cell> ? ephemeralPolicy, Cell? bind, Context context, TissueReceptor<E, Tissue< receptor, TestTissue<E> >E, Tissue< testRule, Synapses<E> >Pulse, Cell> synapses}) -
Creates a Tissue with explicit governance and lifecycle policies.
factory
-
Tissue.unmodifiable(Tissue<
E> bind, {Context? context, bool unmodifiableElement}) -
Creates a read‑only, reactive projection (Deputy) of an existing Tissue.
factory
Properties
-
async
→ ModifiableAsync<
Cell> -
Provides a high‑level, asynchronous interface for interacting with this
collection.
no setteroverride
- context → Context
-
The Context defining the authority tier, priority, and security domain
of this collection.
no setteroverride
- first → E
-
The first element.
no setterinherited
- firstOrNull → T?
-
Available on Iterable<
The first element of this iterator, orT> , provided by the IterableExtensions extensionnullif the iterable is empty.no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- id → String
-
A stable, serialisable identifier for this cell handle.
no setterinherited
-
indexed
→ Iterable<
(int, T)> -
Available on Iterable<
Pairs of elements of the indices and elements of this iterable.T> , provided by the IterableExtensions extensionno setter - isEmpty → bool
-
Whether this collection has no elements.
no setterinherited
- isGoverned → bool
-
Indicates whether this tissue is governed.
no setteroverride
- isInvalidated → bool
-
Indicates whether this tissue has been invalidated by its
EphemeralPolicy (e.g., TTL expired).
no setteroverride
- isNotEmpty → bool
-
Whether this collection has at least one element.
no setterinherited
- isTerminal → bool
-
Indicates whether this tissue is a terminal node – i.e., it has no
downstream observers and does not broadcast pulses.
no setteroverride
-
iterator
→ Iterator<
E> -
A new
Iteratorthat allows iterating the elements of thisIterable.no setterinherited - last → E
-
The last element.
no setterinherited
- lastOrNull → T?
-
Available on Iterable<
The last element of this iterable, orT> , provided by the IterableExtensions extensionnullif the iterable is empty.no setter - length → int
-
The number of elements in this Iterable.
no setterinherited
-
modifiable
→ Iterable<
Function> -
The exhaustive whitelist of functions that can be invoked via
apply.no setteroverride -
nonNulls
→ Iterable<
T> -
Available on Iterable<
The non-T?> , provided by the NullableIterableExtensions extensionnullelements of this iterable.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- single → E
-
Checks that this iterable has only one element, and returns that element.
no setterinherited
- singleOrNull → T?
-
Available on Iterable<
The single element of this iterator, orT> , provided by the IterableExtensions extensionnull.no setter -
skippedReport
→ Map<
String, dynamic> ? -
Available on Tissue<
TheE> , provided by the TissueSkippedReport extension{'wire': [...], 'decode': [...]}skip report, ornullwhen no skip occurred.no setter -
toJSIterable
→ JSIterable<
T> -
Available on Iterable<
A JSIterable wrapper that proxies to the Dart iterable API.T> , provided by the IterableToJSIterable extensionno setter -
unmodifiable
→ Tissue<
E> -
Returns a read‑only, reactive projection (Deputy) of this Tissue.
no setteroverride
-
validate
→ TestTissue<
dynamic, Tissue> -
The TestTissue validation logic currently governing this collection.
no setteroverride
-
wait
→ Future<
List< T> > -
Available on Iterable<
Waits for futures concurrently.Future< , provided by the FutureIterable extensionT> >no setter
Methods
-
any(
bool test(E element)) → bool -
Checks whether any element of this iterable satisfies
test.inherited -
apply<
R> (ApplyCommand command, {ApplyTransactionScope? tx}) → FutureOr< ApplyOutcome< R> > -
Executes a governed mutation on this tissue through the command gateway.
override
-
asNameMap(
) → Map< String, T> -
Available on Iterable<
Creates a map from the names of enum values to the values.T> , provided by the EnumByName extension -
attach(
dynamic context) → Iterable< Pulse> -
Available on Iterable<
Returns a new collection of pulses, each with the providedPulse> , provided by the PulseIterableExtension extensioncontextmetadata attached. -
batch(
) → Pulse -
Available on Iterable<
Aggregates multiple signals into a single, flat CollectivePulse.Pulse> , provided by the PulseIterableExtension extension -
byName(
String name) → T -
Available on Iterable<
Finds the enum value in this list with nameT> , provided by the EnumByName extensionname. -
cast<
R> () → Iterable< R> -
A view of this iterable as an iterable of
Rinstances.inherited -
command(
Function function) → ApplyCommandRunner -
Available on Cell, provided by the ApplyCommandDSL extension
Begins assembling a command that invokesfunctionon this cell. -
contains(
Object? element) → bool -
Whether the collection contains an element equal to
element.inherited -
deputy(
{covariant DeputyContext context = DeputyContext.system, covariant TestTissue< dynamic, Tissue> testRule = TestTissue.allowAll, EphemeralPolicy<Cell> ? ephemeralPolicy, Synapses<Pulse, Cell> synapses = Synapses.enabled}) → FutureOr<Tissue< E> > -
Synthesizes a specialised Mandate Handle (Deputy) of this collection,
providing a scoped, authoritative interface to the underlying state.
override
-
elementAt(
int index) → E -
Returns the
indexth element.inherited -
elementAtOrNull(
int index) → T? -
Available on Iterable<
The element at positionT> , provided by the IterableExtensions extensionindexof this iterable, ornull. -
every(
bool test(E element)) → bool -
Checks whether every element of this iterable satisfies
test.inherited -
expand<
T> (Iterable< T> toElements(E element)) → Iterable<T> -
Expands each element of this Iterable into zero or more elements.
inherited
-
filter<
S> ({required bool test(S value)}) → FlowHandle -
Available on Cell, provided by the CellFlowOperators extension
Materializes a Predicate Integrity Gate—a specialized orchestration instruction designed to conditionally permit pulse evolution. -
firstWhere(
covariant bool test(E element), {covariant E orElse()?}) → E -
The first element that satisfies the given predicate
test.override -
flatten(
) → Iterable< Pulse> -
Available on Iterable<
Recursively flattens any nested CollectivePulse structures into a sequence of simple pulses.Pulse> , provided by the PulseIterableExtension extension -
fold<
T> (T initialValue, T combine(T previousValue, E element)) → T -
Reduces a collection to a single value by iteratively combining each
element of the collection with an existing value
inherited
-
followedBy(
covariant Iterable< E> other) → Iterable<E> -
Creates the lazy concatenation of this iterable and
other.override -
forEach(
void action(E element)) → void -
Invokes
actionon each element of this iterable in iteration order.inherited -
fromFuture<
S> ({required Future< S> future, Duration? timeout, FutureErrorHandler? onError, bool emitErrorPulse = true}) → FlowHandle -
Available on Cell, provided by the CellFlowOperators extension
Synthesizes a Temporal Resource Bridge from a Future. -
fromIterable<
T> ({required Iterable< T> iterable}) → FlowHandle -
Available on Cell, provided by the CellFlowOperators extension
Synthesizes an Iterative Pulse Bridge from a dynamic iterable. -
fromStream<
S> ({required Stream< S> stream, StreamErrorHandler? onError, bool emitErrorPulse = true}) → FlowHandle -
Available on Cell, provided by the CellFlowOperators extension
Synthesizes a Continuous Pulse Bridge from a Stream. -
join(
[String separator = ""]) → String -
Converts each element to a String and concatenates the strings.
inherited
-
lastWhere(
covariant bool test(E element), {covariant E orElse()?}) → E -
The last element that satisfies the given predicate
test.override -
map<
T> (T toElement(E e)) → Iterable< T> -
The current elements of this iterable modified by
toElement.inherited -
map<
S, T> ({required T project(S value), MapErrorHandler? onError}) → FlowHandle -
Available on Cell, provided by the CellFlowOperators extension
Materializes a Projective Evolution Gate—a fundamental instruction designed to transform stimulus payloads as they traverse the topography. -
mapEach<
T> (T mapper(dynamic payload)) → Iterable< Pulse< T> > -
Available on Iterable<
Transforms the payload of every pulse in the collection while preserving their individual causal traces.Pulse> , provided by the PulseIterableExtension extension -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
of<
T> ({required Iterable< T> values}) → FlowHandle -
Available on Cell, provided by the CellFlowOperators extension
Synthesizes a Fixed Sequence Bridge from a provided collection. -
range(
{required int start, required int count, int step = 1}) → FlowHandle -
Available on Cell, provided by the CellFlowOperators extension
Synthesizes a Counted Pulse Generator—a specialized bridge designed to evolve a sequence of arithmetic integers. -
reduce(
covariant E combine(E value, E element)) → E -
Reduces a collection to a single value by iteratively combining elements
of the collection using the provided function.
override
-
repeat<
T> ({required T value, int count = 1}) → FlowHandle -
Available on Cell, provided by the CellFlowOperators extension
Synthesizes a Recursive Stimulus Bridge—a specialized generator designed to evolve the same payload multiple times. -
singleWhere(
bool test(E element), {E orElse()?}) → E -
The single element that satisfies
test.inherited -
skip(
int count) → Iterable< E> -
Creates an Iterable that provides all but the first
countelements.inherited -
skipWhile(
bool test(E element)) → Iterable< E> -
Creates an
Iterablethat skips leading elements whiletestis satisfied.inherited -
take(
int count) → Iterable< E> -
Creates a lazy iterable of the
countfirst elements of this iterable.inherited -
takeWhile(
bool test(E element)) → Iterable< E> -
Creates a lazy iterable of the leading elements satisfying
test.inherited -
tap<
S> ({required void onValue(S value), TapErrorHandler? onError}) → FlowHandle -
Available on Cell, provided by the CellFlowOperators extension
Materializes a Passive Observation Gate—a specialized orchestration instruction designed to perform side-effects without altering pulse evolution. -
toList(
{bool growable = true}) → List< E> -
Creates a List containing the elements of this Iterable.
inherited
-
toSet(
) → Set< E> -
Creates a Set containing the same elements as this iterable.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
where(
bool test(E element)) → Iterable< E> -
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<
Appends a diagnostic stage to the causal trace of every pulse in this collection.Pulse> , provided by the PulseIterableExtension extension
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
create<
E, I extends Iterable< (E> , C extends Tissue<E> >{Iterable< E> ? elements, Cell? bind, Context? context = Context.system, TissueReceptor<E, C> ? receptor, TestTissue<E, C> ? testRule, Synapses<Pulse, Cell> ? synapses, Container? container, Record? user, dynamic forceLock = false, TissueNucleusBase<E, I, C> ? principal}) → TissueBase<E, I, C> - A low‑level factory for creating a Tissue with explicit control over its internal implementation types and storage.
Constants
- elementAdded → const TissueEvent
- An element has been added to the collection.
- elementRemoved → const TissueEvent
- An element has been removed from the collection.
- elementUpdated → const TissueEvent
- A scalar value or state property has changed.
- entryUpdated → const TissueEvent
- A key-value association has been updated in a map collection.