StateChangeNotifier

Thread-safe notifier for state changes.

This class manages a collection of observers and notifies them when state changes occur. It provides thread-safe registration and unregistration of observers, and handles observer exceptions gracefully.

Parameters

T

The type of state being observed

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard

Returns true if any observers are registered.

Link copied to clipboard

Returns the number of registered observers.

Functions

Link copied to clipboard

Adds an observer to receive state change notifications.

Link copied to clipboard

Creates a StateObserver that forwards notifications to this notifier.

Link copied to clipboard

Removes all observers.

Link copied to clipboard
fun notifyStateChanged(oldState: T, newState: T)

Notifies all registered observers of a state change.

Link copied to clipboard

Removes an observer from receiving state change notifications.