Skip to content

Commit

Permalink
[app_rx] add lastEventOrNull
Browse files Browse the repository at this point in the history
  • Loading branch information
alextekartik committed Jun 16, 2024
1 parent 1aebdc9 commit 4285867
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions app_rx/lib/src/helpers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,13 @@ class _BroadcastValueStream<T> extends Stream<T>

@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<T>? get lastEventOrNull => hasValue
? StreamNotification<T>.data(value)
: hasError
? StreamNotification<T>.error(error)
: null;
}

0 comments on commit 4285867

Please sign in to comment.