Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
hoc081098 committed Feb 8, 2021
1 parent 365f233 commit bf98422
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 20 deletions.
25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,19 @@ Some extension methods and classes built on top of `RxDart` - `RxDart` extension
![Dart CI](https://github.com/hoc081098/rxdart_ext/workflows/Dart%20CI/badge.svg)
[![Pub Version (including pre-releases)](https://img.shields.io/pub/v/rxdart_ext?include_prereleases)](https://pub.dev/packages/rxdart_ext)

- `debug`, `collect`
- `ForwardingSinkMixin`
- `distinctUniqueBy`
- `distinctBy`
- `ignoreElements`, `ignoreErrors`
- `mapNotNull`
- `toSingleSubscription`
- `NotReplayValueStream`
- [debug](https://pub.dev/documentation/rxdart_ext/latest/rxdart_ext/DebugStreamExtension/debug.html), [collect](https://pub.dev/documentation/rxdart_ext/latest/rxdart_ext/CollectStreamExtension/collect.html)
- [ForwardingSinkMixin](https://pub.dev/documentation/rxdart_ext/latest/rxdart_ext/ForwardingSinkMixin-mixin.html)
- [distinctUniqueBy](https://pub.dev/documentation/rxdart_ext/latest/rxdart_ext/DistinctUniqueByStreamExtension/distinctUniqueBy.html)
- [distinctBy](https://pub.dev/documentation/rxdart_ext/latest/rxdart_ext/DistinctByExtension/distinctBy.html)
- [ignoreElements](https://pub.dev/documentation/rxdart_ext/latest/rxdart_ext/IgnoreElementStreamExtension/ignoreElements.html), [ignoreErrors](https://pub.dev/documentation/rxdart_ext/latest/rxdart_ext/IgnoreErrorsStreamExtension/ignoreErrors.html)
- [mapNotNull](https://pub.dev/documentation/rxdart_ext/latest/rxdart_ext/MapNotNullStreamExtension/mapNotNull.html)
- [toSingleSubscription](https://pub.dev/documentation/rxdart_ext/latest/rxdart_ext/ToSingleSubscriptionStreamExtension/toSingleSubscriptionStream.html)
- [whereNotNull](https://pub.dev/documentation/rxdart_ext/latest/rxdart_ext/WhereNotNullStreamExtension/whereNotNull.html)
- [NotReplayValueStream](https://pub.dev/documentation/rxdart_ext/latest/rxdart_ext/NotReplayValueStream-class.html)
- Broadcast
- `ValueSubject`
- `NotReplayValueConnectableStream`, `publishValueNotReplay`, `shareValueNotReplay`
- [ValueSubject](https://pub.dev/documentation/rxdart_ext/latest/rxdart_ext/ValueSubject-class.html)
- [NotReplayValueConnectableStream](https://pub.dev/documentation/rxdart_ext/latest/rxdart_ext/NotReplayValueConnectableStream-class.html), [publishValueNotReplay](https://pub.dev/documentation/rxdart_ext/latest/rxdart_ext/ValueConnectableNotReplayStreamExtensions/publishValueNotReplay.html), [shareValueNotReplay](https://pub.dev/documentation/rxdart_ext/latest/rxdart_ext/ValueConnectableNotReplayStreamExtensions/shareValueNotReplay.html)
- Single-subscription
- `ValueStreamController`
- `toNotReplayValueStream`
- [ValueStreamController](https://pub.dev/documentation/rxdart_ext/latest/rxdart_ext/ValueStreamController-class.html)
- [toNotReplayValueStream](https://pub.dev/documentation/rxdart_ext/latest/rxdart_ext/ToNotReplayValueStreamExtension/toNotReplayValueStream.html)

20 changes: 13 additions & 7 deletions lib/src/ignore.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import 'dart:async';

import 'default_sink.dart';

/// Ignore all data events, forward error and done event.
extension IgnoreElementStreamExtension<T> on Stream<T> {
/// Ignore all data events, forward error and done event.
Expand All @@ -12,14 +14,18 @@ extension IgnoreElementStreamExtension<T> on Stream<T> {
}
}

class _IgnoreErrorsStreamSink<T>
with ForwardingSinkMixin<T, T>
implements ForwardingSink<T, T> {
@override
void add(EventSink<T> sink, T data) {}

@override
void addError(EventSink<T> sink, Object error, [StackTrace? st]) {}
}

/// Ignore all error events, forward data and done event.
extension IgnoreErrorsStreamExtension<T> on Stream<T> {
/// Ignore all error events, forward data and done event.
Stream<T> ignoreErrors() {
return transform<T>(
StreamTransformer.fromHandlers(
handleError: (e, s, sink) {},
),
);
}
Stream<T> ignoreErrors() => forwardStream(this, _IgnoreErrorsStreamSink());
}
2 changes: 1 addition & 1 deletion lib/src/where_not_null.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class _WhereNotNullStreamSink<T extends Object>
/// Extends the Stream class with the ability to convert the source Stream
/// to a Stream which emits all the non-`null` elements
/// of this Stream, in their original emission order.
extension WhereNotNullExtension<T extends Object> on Stream<T?> {
extension WhereNotNullStreamExtension<T extends Object> on Stream<T?> {
/// Returns a Stream which emits all the non-`null` elements
/// of this Stream, in their original emission order.
///
Expand Down

0 comments on commit bf98422

Please sign in to comment.