Conduit<T> class
abstract
A pipeline stage that intercepts individual Core state changes.
Conduits are composable: multiple Conduits can be attached to a single Core, and each transforms the value in sequence before it is applied.
Creating a Conduit
class LogConduit<T> extends Conduit<T> {
final String label;
LogConduit(this.label);
@override
T pipe(T oldValue, T newValue) {
print('$label: $oldValue → $newValue');
return newValue; // Pass through unchanged
}
}
Using with Core
final count = Core<int>(0, conduits: [
ClampConduit(min: 0, max: 99),
LogConduit('count'),
]);
Using with Pillar
class GamePillar extends Pillar {
late final health = core(100, conduits: [
ClampConduit(min: 0, max: 100),
]);
}
Constructors
- Conduit()
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onPiped(
T oldValue, T newValue) → void - Called after the value change has been successfully applied.
-
pipe(
T oldValue, T newValue) → T - Transforms or validates the new value before it is applied.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited