A high-performance custom node computation optimized for a single inbound dependency (1:1).
Unlike ComplexComputation which manages an N:1 list of inbound dependencies, SimplexComputation binds directly to a single upstream CoralNode returned by manifest.
Design Philosophy:
Single-input transformation nodes (such as map, where, or distinct) constitute
the majority of reactive graph nodes. SimplexComputation eliminates array allocations
and loop overhead by storing a direct field reference to its single inbound node.
Extreme Performance Optimization:
- Zero Extra Heap Allocation: Avoids allocating
List.unmodifiablecontainers. - Direct Field Reference: Accesses
_inbounddirectly without array index lookups. - Hot-Path Inlining: Enables Dart VM method inlining on graph activation loops.
AI & Developer Note: Use SimplexComputation whenever a computation has exactly one upstream source. If your node requires multiple dependencies or dynamic manifest lists, use ComplexComputation.
Example:
class DoubleComputation extends SimplexComputation<int> {
DoubleComputation(this.source);
final Coral<int> source;
@override
@manifestSync
CoralNode manifest() => source;
@override
int compute() => source.data * 2;
}
- Inheritance
-
- Object
- CoralComputation<
T> - SimplexComputation
- Implementers
- Available extensions
Constructors
Properties
-
coral
→ Coral<
T> -
Exposes the underlying topological node that powers this computation.
no setterinherited
- debugCreationLocation → String?
-
Available on CoralComputation, provided by the CoralComputationDebugExtension extension
no setter - debugTag → String?
-
Available on CoralComputation, provided by the CoralComputationDebugExtension extension
no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- isActivated → bool
-
Indicates whether the underlying topological node is currently active in the graph.
no setterinherited
- isDeactivated → bool
-
Indicates whether the underlying topological node is currently deactivated.
no setterinherited
- isPaused → bool
-
Indicates whether the underlying topological node is currently in a paused state.
no setterinherited
- isRunning → bool
-
Indicates whether the underlying topological node is running and processing events.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
cascade<
T> (Coral< T> cascade(S data), {bool eager = false}) → Coral<T> -
Available on CoralProvider<
Delegates CoralComputationExtension.cascade to the underlying Coral.S> , provided by the CoralProviderComputationExtension extension -
compute(
) → T -
Performs the actual computation and returns the new value for this node based on the single upstream dependency.
override
-
debugTrace(
[String? tag, int traceCount = 5]) → void -
Available on CoralComputation, provided by the CoralComputationDebugExtension extension
-
distinct(
[bool equals(S previous, S next)?]) → Coral< S> -
Available on CoralProvider<
Delegates CoralComputationExtension.distinct to the underlying Coral.S> , provided by the CoralProviderComputationExtension extension -
diverge<
T> (Iterable< Coral< cascade(S data), {bool seal = true, bool hotswap = false, bool eager = false}) → Trunk<T> >T> -
Available on CoralProvider<
Delegates CoralComputationExtension.diverge to the underlying Coral.S> , provided by the CoralProviderComputationExtension extension -
fallback(
{S onEmpty()?, S onDamage(Object error, [StackTrace? stackTrace])?}) → Coral< S> -
Available on CoralProvider<
Delegates CoralComputationExtension.fallback to the underlying Coral.S> , provided by the CoralProviderComputationExtension extension -
fallbackEmptyToNull(
) → Coral< S?> -
Available on CoralProvider<
Delegates CoralComputationExtension.fallbackEmptyToNull to the underlying Coral.S> , provided by the CoralProviderComputationExtension extension -
guard(
{required bool canProceed(), Object? getReasonIfCannotProceed()?}) → Coral< S> -
Available on CoralProvider<
Delegates CoralComputationExtension.guard to the underlying Coral.S> , provided by the CoralProviderComputationExtension extension -
iterateInbound(
) → Iterable< CoralNode> -
Iterates over all direct upstream inbound nodes connected to this computation.
inherited
-
manifest(
) → CoralNode - Declares the single upstream dependency node this computation reads from.
-
map<
T> (T convert(S source)) → Coral< T> -
Available on CoralProvider<
Delegates CoralComputationExtension.map to the underlying Coral.S> , provided by the CoralProviderComputationExtension extension -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toBroadcaster(
) → CoralBroadcaster< S> -
Available on CoralProvider<
S> , provided by the CoralProviderExtension extension -
toInheritedWidget(
{Key? key, required Widget child}) → InheritedCoralProviderWidget< T> -
Available on CoralProvider<
Converts this CoralProvider into an InheritedCoralProviderWidget.T> , provided by the CoralProviderInheritedWidgetExtension extension -
toString(
) → String -
A string representation of this object.
inherited
-
toTerminal(
void onDirty()) → CoralTerminal< S> -
Available on CoralProvider<
S> , provided by the CoralProviderExtension extension -
toWidget(
{Key? key, Widget errorBuilder(BuildContext context, Object error, StackTrace? stackTrace)?}) → CoralWidget -
Available on T, provided by the CoralComputationWidgetExtension extension
Converts this Computation into a strongly-typed CoralWidget. -
toWidget(
{Key? key, Widget errorBuilder(BuildContext context, Object error, StackTrace? stackTrace)?}) → CoralWidget -
Available on CoralProvider<
Converts this CoralProvider into a CoralWidget.Widget> , provided by the CoralWidgetProviderExtension extension
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited