SignalsObserver class abstract
You can observe all signal values in the dart application by providing an implementation of SignalsObserver
:
abstract class SignalsObserver {
void onSignalCreated(Signal instance);
void onSignalUpdated(Signal instance, dynamic value);
void onComputedCreated(Computed instance);
void onComputedUpdated(Computed instance, dynamic value);
static SignalsObserver? instance;
}
There is a prebuilt
LoggingSignalsObserver
for printing updates to the console.
To add the observer override the instance at the start of the application:
void main() {
SignalsObserver.instance = LoggingSignalsObserver(); // or custom observer
...
}
This will have a slight performance hit since every update will be tracked via the observer. It is recommended to only set the SignalsObserver.instance
in debug or profile mode.
@link https://dartsignals.dev/utilities/observer
Constructors
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
-
onComputedCreated(
Computed instance) → void - Called when a computed is created.
-
onComputedUpdated(
Computed instance, dynamic value) → void - Called when a computed is updated.
-
onEffectCalled(
Effect instance) → void - Called when a effect is called.
-
onEffectCreated(
Effect instance) → void - Called when a effect is created.
-
onEffectRemoved(
Effect instance) → void - Called when a effect is disposed.
-
onSignalCreated(
Signal instance) → void - Called when a signal is created.
-
onSignalUpdated(
Signal instance, dynamic value) → void - Called when a signal is updated.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- instance ↔ SignalsObserver?
-
The current observer instance.
getter/setter pair