A logic block. Logic blocks are machines that receive input, maintain a single state, and produce outputs. They can be used as simple input-to-state reducers or built upon to create hierarchical state machines.
- Inheritance
-
- Object
- LogicBlockBase
- LogicBlock
- Implemented types
Constructors
- LogicBlock()
- A logic block. Logic blocks are machines that receive input, maintain a single state, and produce outputs. They can be used as simple input-to-state reducers or built upon to create hierarchical state machines.
Properties
- blackboard → Blackboard
-
The blackboard data store shared across states.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- isDisposed → bool
-
Whether the logic block has been disposed.
no setter
- isProcessing → bool
-
Whether the logic block is currently processing inputs.
no setter
- isStarted → bool
-
Whether the logic block is currently started and can receive inputs.
no setter
- isStopped → bool
-
Whether the logic block is stopped (not yet started or explicitly
stopped).
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- status → LogicBlockStatus
-
The lifecycle status of this logic block.
no setter
-
task
→ Future<
void> -
A Future that completes when all in-flight async operations started
via StateLogic.async have finished.
no setter
- value → TState
-
The current state of the logic block.
no setter
- valueAsObject → Object?
-
The current state as an untyped Object, or
nullif the logic block has not been started.no setteroverride
Methods
-
bind(
) → LogicBlockBinding< TState> - Creates a new LogicBlockBinding that listens to this logic block.
-
dispose(
) → void - Disposes the logic block, stopping it first if running, then cleaning up all internal resources.
-
forceReset(
TState state) → TState -
Forcibly resets the logic block to the given
state, exiting and detaching the current state. -
get<
TData extends Object> () → TData -
Gets a value of type
TDatafrom the blackboard. -
getInitialState(
) → Transition - Returns a Transition representing the initial state of the logic block.
-
handleError(
Object e) → void - Called whenever an error is reported by a state. Override to handle errors produced during state logic execution.
-
handleGenericQueueItem<
TInput extends Object> (GenericQueue queue, TInput input) → void -
Handles a single dequeued item along with its generic type
TItem.override -
input<
TInput extends Object> (TInput input) → TState -
Adds an
inputvalue to the logic block's internal input queue. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onStart(
) → void - Called after the logic block has been started for the first time. Override to perform setup after initial state entry.
-
onStop(
) → void - Called after the logic block has been stopped. Override to perform teardown after final state exit.
-
restoreFrom(
LogicBlock< TState> logic) → void -
Restores this logic block's state and blackboard from another
logicblock of the same type. -
restoreState(
Object state) → void -
set<
TData extends Object> (TData data) → void -
Sets a value of type
TDataon the blackboard. -
start(
) → TState - Starts the logic block by entering the initial state and returns it.
-
stop(
) → void - Stops the logic block, calling exit and detach callbacks on the current state before clearing the input queue.
-
to<
TStateType extends TState> () → Transition -
Defines a transition to the state of type
TStateTypestored on the blackboard. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
Static Methods
-
createFakeBinding<
TState extends StateLogic< (TState> >) → LogicBlockFakeBinding< StateLogic> - Creates a LogicBlockFakeBinding for testing binding callbacks without a real logic block instance.
-
isEquivalent(
Object? a, Object? b) → bool -
Returns
trueifaandbare equivalent — that is, identical, both null, equal, or of the same runtime type.