RiftSignal<T> class

Reactive signals integration for Rift. Creates reactive signals from box values that auto-update on data changes.

The signals system provides a lightweight reactive primitive that can be used with any UI framework. Each signal wraps a value and notifies listeners when the value changes.

Usage:

final factory = RiftSignalFactory();

// Create a signal for a specific key
final nameSignal = factory.forKey<String>(box, 'user_name');
nameSignal.listen((name) => print('Name changed to: $name'));

// Create a signal for the entire box
final boxSignal = factory.forBox(box);
boxSignal.listen((state) => print('Box changed: $state'));

// Clean up
factory.disposeAll();

A reactive signal that holds a value and notifies listeners on change.

Signals are the fundamental reactive primitive. They hold a single value and emit updates through both a Stream and direct listener callbacks.

Value equality is used to prevent unnecessary notifications: if the new value is equal to the current value (using ==), no notification is emitted.

Constructors

RiftSignal(T _value)
Create a RiftSignal with an initial value.

Properties

hashCode int
The hash code for this object.
no setterinherited
isDisposed bool
Whether the signal has been disposed.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stream Stream<T>
A stream of value changes.
no setter
value → T
The current value of the signal.
no setter

Methods

dispose() → void
Dispose of the signal, closing the stream and clearing listeners.
listen(void listener(T)) → void
Register a listener that is called when the value changes.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeListener(void listener(T)) → void
Remove a previously registered listener.
set(T newValue) → void
Set a new value for the signal.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited