stream property
Returns a stream of snapshots containing the old and new values after each change.
The stream is a BehaviorSubject, which means new subscribers immediately receive
the current value. Each Snapshot emitted contains both the previous value
(Snapshot.oldValue) and the new value (Snapshot.newValue).
Example:
final name = Reactive('John');
// Subscribe to changes
final subscription = name.stream.listen((snapshot) {
print('Name changed from "${snapshot.oldValue}" to "${snapshot.newValue}"');
});
name.value = 'Jane'; // Prints: Name changed from "John" to "Jane"
// Don't forget to cancel the subscription when no longer needed
subscription.cancel();
Implementation
Stream<Snapshot<T>> get stream => _controller.stream;