lastEventOrNull property

  1. @override
StreamNotification<T>? get lastEventOrNull
override

Returns the last emitted event (either data/value or error event). null if no value or error events have been emitted yet.

Implementation

@override
StreamNotification<T>? get lastEventOrNull {
  // data event
  if (_wrapper.isValue) {
    return StreamNotification.data(_wrapper.value as T);
  }

  // error event
  final errorAndSt = _wrapper.errorAndStackTrace;
  if (errorAndSt != null) {
    return ErrorNotification(errorAndSt);
  }

  // no event
  return null;
}