diff --git a/app_rx/lib/src/helpers.dart b/app_rx/lib/src/helpers.dart index 56d8dfc..62797c4 100644 --- a/app_rx/lib/src/helpers.dart +++ b/app_rx/lib/src/helpers.dart @@ -112,4 +112,13 @@ class _BroadcastValueStream extends Stream @override T? get valueOrNull => _subject.valueOrNull; + + /// Returns the last emitted event (either data/value or error event). + /// `null` if no value or error events have been emitted yet. + @override + StreamNotification? get lastEventOrNull => hasValue + ? StreamNotification.data(value) + : hasError + ? StreamNotification.error(error) + : null; }