A specialised, terminal architectural interface for a Governed Reactive Value Cell.
TissueValue represents the atomic unit of state within the
cell_tissue ecosystem. It mirrors the standard value-cell contract
(synchronous read/write plus observable updates) on top of the Tissue
governance model, creating a state node that is simultaneously a
physical storage container, an observable pulse source, and a governed
security boundary.
It deliberately does not implement ValueCell: a TissueValue participates in Cell.transaction through the generic Cell apply path, so transactions treat it as a tissue (validation, pulses, ledger entries) instead of reaching into value-cell internals.
When to use
Use a TissueValue whenever you need a single, reactive value that:
- Must be observable (UI updates automatically on changes).
- Must enforce invariants (e.g., value range, non‑null constraints).
- Must be shared between components with different permissions (via deputies).
- Must participate in the reactive graph as a first‑class cell.
- Needs to be write‑once (
finalValue) or mutable.
Most of the time, you create a TissueValue using the TissueValue factory,
optionally providing a testRule for validation:
final counter = TissueValue<int>(0);
final validated = TissueValue<String>(
testRule: TestTissue<String>((v) => v.isNotEmpty),
);
How it works
- Internally, it uses a TissueValueNucleus to govern behaviour and a ValueContainer for physical storage.
- Every mutation (e.g.,
value = ...,set(...)) goes through a validation pipeline (testRule) and emits a Tissue.elementUpdated. - The value is thread‑safe via its internal Lock.
- It can be deputised to create restricted views (read‑only, scoped authority, etc.) that share the same storage.
- It supports both mutable and write‑once (
finalValue) storage. - If the value is a Cell, it is automatically linked to the tissue, enabling "bubbling" of internal changes.
Example: Basic usage
final counter = TissueValue<int>(0);
counter.value = 1;
print(counter.value); // 1
// Listen for changes
counter.listen((event) {
if (event.type == Tissue.elementUpdated) {
final record = event.payload!;
print('Changed from ${record.before} to ${record.after}');
}
});
counter.value = 42; // prints "Changed from 1 to 42"
Example: Validation
final validAge = TissueValue<int>(
testRule: TestTissue<int>((v) => v >= 0 && v <= 120),
);
validAge.value = 25; // allowed
validAge.value = 150; // rejected – no event emitted
Example: Write‑once value
final config = TissueValue<String>(
finalValue: true,
);
config.value = 'production'; // allowed
config.value = 'development'; // rejected – value already set
Example: Read‑only deputy for UI
final source = TissueValue<int>(42);
final uiView = source.deputy(testRule: TestTissue.readOnly);
// uiView can be safely passed to a widget tree
// Changes to source are reflected in uiView automatically
Type Parameters:
V: The type of the value held by this cell.
See also:
- Tissue – the base interface for all reactive collections.
- TissueValueNucleus – the blueprint and configuration for the value.
- UnmodifiableTissueValue – a read‑only deputy variant.
- Tissue.elementUpdated – the event emitted on value changes.
AI Agent Guide
Layer: Tissue — the reserve scalar. Not a Cell factory, not a Flow operator.
When to use: "45,000 bags / 42 trolleys / 800 MW / ledger cents" — one governed number with an invariant (TestTissue >= 0) plus a harness pre-check.
When NOT to use:
Cell.state<int> when the WalkThrough named a reserve book.
Live signature: TissueValue<V>(V? value, {bind, context, testRule, receptor, synapses, finalValue}) / TissueValue.empty({...}) / TissueValue.unmodifiable(bind) — pinned at cell_tissue: 1.2.0
Do NOT confuse with: Cell.state (retained setting without Tissue semantics).
Guide: HowTo-Mitose-Tissue.md §2.5 "TissueValue — the reserve scalar" (#tissue-value)
Example: example/cell_tissue_example.dart
Cross-layer: the conservation invariant (value + sum(map.values) == baseline) is a harness read, not a second write path.
Minimal compilable example
final q = TissueQueue<int>(capacity: 3);
q.addLast(1);
q.addLast(2);
print(q.length); // 2
- Implemented types
-
- Tissue<
V>
- Tissue<
- Available extensions
Constructors
-
TissueValue(V? value, {Cell? bind, Context context, TestTissue<
V, TissueValue< testRule, TissueReceptor<V> >V, TissueValue< receptor, Synapses<V> >Pulse, Cell> synapses, bool finalValue}) -
Primary architectural factory for instantiating a TissueValue,
creating a reactive, singular state node governed by the Conactive Model.
factory
-
TissueValue.empty({Cell? bind, Context context, TestTissue<
V, TissueValue< testRule, TissueReceptor<V> >V, TissueValue< receptor, Synapses<V> >Pulse, Cell> synapses}) -
Architectural factory for instantiating an empty, reactive TissueValue
governed by the Conactive Model.
factory
-
TissueValue.fromJson(Map<
String, dynamic> json, {TissueCellResolver? cellResolver, TissueGovernanceResolver? governanceResolver, bool lenient = false, TestTissue<dynamic, Tissue> lenientFallbackTestRule = TestTissue.readOnly, void onSkipped(List<String> skipped)?, Object? testRule, Context? context, Object? bind, Object? container, Object? user, Object? value}) -
Reconstructs a TissueValue from the canonical JSON produced by
encodeTissue/ TissueValueJson.toJson.factory -
TissueValue.fromNucleus(TissueValueNucleus<
V> nucleus, {V? value}) -
Primary architectural factory for materialising a TissueValue from
an existing TissueValueNucleus (the "Reactive DNA").
factory
-
TissueValue.unmodifiable(TissueValue<
V> bind) -
A high‑fidelity architectural factory for creating a Deeply
Immodifiable Reactive View (Deputy) of an existing TissueValue.
factory
Properties
-
async
→ ModifiableValueAsync<
V> -
Provides an asynchronous interface for performing mutation operations.
no setteroverride
- context → Context
-
The Context defining the authority tier, priority, and security domain
of this collection.
no setterinherited
- first → V
-
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 setterinherited
- isInvalidated → bool
-
Indicates whether this tissue has been invalidated by its
EphemeralPolicy (e.g., TTL expired).
no setterinherited
- 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 setterinherited
-
iterator
→ Iterator<
V> -
A new
Iteratorthat allows iterating the elements of thisIterable.no setterinherited - last → V
-
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 setterinherited -
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 → V
-
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
→ TissueValue<
V> -
Returns a read‑only, reactive projection (Deputy) of this TissueValue.
no setteroverride
-
validate
→ TestTissue<
dynamic, Tissue> -
The TestTissue validation logic currently governing this collection.
no setterinherited
- value ↔ V?
-
Returns the current payload held within this reactive value container.
getter/setter pair
-
wait
→ Future<
List< T> > -
Available on Iterable<
Waits for futures concurrently.Future< , provided by the FutureIterable extensionT> >no setter
Methods
-
any(
bool test(V 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.
inherited
-
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<TissueValue< V> > -
Creates a "Deputy" projection of this value—a specialised proxy that
shares the same physical data but operates under unique behavioural rules.
override
-
elementAt(
int index) → V -
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(V element)) → bool -
Checks whether every element of this iterable satisfies
test.inherited -
expand<
T> (Iterable< T> toElements(V 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(V element), {covariant V orElse()?}) → V -
The first element that satisfies the given predicate
test.inherited -
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, V 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< V> other) → Iterable<V> -
Creates the lazy concatenation of this iterable and
other.inherited -
forEach(
void action(V 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(V element), {covariant V orElse()?}) → V -
The last element that satisfies the given predicate
test.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. -
map<
T> (T toElement(V e)) → Iterable< T> -
The current elements of this iterable modified by
toElement.inherited -
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 V combine(V value, V element)) → V -
Reduces a collection to a single value by iteratively combining elements
of the collection using the provided function.
inherited
-
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. -
set(
V? value) → bool - Attempts to update the current payload, returning a boolean indicating whether the state transition was successfully committed.
-
singleWhere(
bool test(V element), {V orElse()?}) → V -
The single element that satisfies
test.inherited -
skip(
int count) → Iterable< V> -
Creates an Iterable that provides all but the first
countelements.inherited -
skipWhile(
bool test(V element)) → Iterable< V> -
Creates an
Iterablethat skips leading elements whiletestis satisfied.inherited -
take(
int count) → Iterable< V> -
Creates a lazy iterable of the
countfirst elements of this iterable.inherited -
takeWhile(
bool test(V element)) → Iterable< V> -
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. -
toJson(
{bool lenient = false, TestTissue< dynamic, Tissue> lenientFallbackTestRule = TestTissue.readOnly}) → Map<String, dynamic> -
Available on TissueValue<
Encodes this value to its canonical JSON wire form.V> , provided by the TissueValueJson extension -
toList(
{bool growable = true}) → List< V> -
Creates a List containing the elements of this Iterable.
inherited
-
toSet(
) → Set< V> -
Creates a Set containing the same elements as this iterable.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
where(
bool test(V element)) → Iterable< V> -
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 - Comparison operators for numeric values
-
operator <=(
Object other) → bool - Comparison operators for numeric values
-
operator ==(
Object other) → bool -
Comparison operators for objects
override
-
operator >(
Object other) → bool - Comparison operators for numeric values
Static Methods
-
create<
V, C extends TissueValue< (V> >{V? value, Cell? bind, Context? context, TissueReceptor< V, C> ? receptor, TestTissue<V, C> ? testRule, Synapses<Pulse, Cell> ? synapses, Container? container, Record? user, dynamic forceLock = false, TissueValueNucleusBase<V, C> ? principal}) → TissueValueBase<V, C> -
A high‑level architectural factory for creating a specialised, type‑safe
reactive value with explicit control over its behavioural and structural blueprint.
override