Skip to content

SignalsObserver

You can observe all signal values in the dart application by providing an implementation of SignalsObserver:

abstract class SignalsObserver {
void onSignalCreated(Signal instance, dynamic value);
void onSignalUpdated(Signal instance, dynamic value);
void onComputedCreated(Computed instance);
void onComputedUpdated(Computed instance, dynamic value);
static SignalsObserver? instance;
}

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.

Disable Logging

To disable logging you can use the following code:

void main() {
SignalsObserver.instance = null;
...
}