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
LoggingSignalsObserverfor 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.
Properties#
Methods#
View Methods
void onSignalCreated(Signal<T> instance, T value)
Called when a signal is created.
void onSignalUpdated(Signal<T> instance, T value)
Called when a signal is updated.
void onComputedCreated(Computed<T> instance)
Called when a computed is created.
void onComputedUpdated(Computed<T> instance, T value)
Called when a computed is updated.
void onEffectCreated(Effect instance)
Called when a effect is created.
void onEffectCalled(Effect instance)
Called when a effect is called.
void onEffectRemoved(Effect instance)
Called when a effect is disposed.