Skip to content
This repository has been archived by the owner on Sep 14, 2021. It is now read-only.

Commit

Permalink
1.2.0-nullsafety.2
Browse files Browse the repository at this point in the history
  • Loading branch information
hoc081098 committed Jan 8, 2021
1 parent 8738d68 commit 8c57b53
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 8 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,9 @@
## 1.2.0-nullsafety.2 - Jan 9, 2021

- **Breaking change**: Any errors from upstream and from `equals` callback will be not added to Stream.
They are considered unhandled, and will be passed to the current `Zone`'s error handler.
By default, unhandled async errors are treated as if they were uncaught top-level errors.

## 1.2.0-nullsafety.1 - Jan 8, 2021

- Update README.md.
Expand Down
4 changes: 0 additions & 4 deletions analysis_options.yaml
Expand Up @@ -4,10 +4,6 @@ analyzer:
strong-mode:
implicit-casts: false
implicit-dynamic: false
exclude:
# Ignore generated files
- "**/*.g.dart"
- "lib/src/generated/*.dart"

linter:
rules:
Expand Down
5 changes: 3 additions & 2 deletions lib/src/distinct_value_connectable_stream.dart
Expand Up @@ -99,8 +99,9 @@ class DistinctValueConnectableStream<T> extends ConnectableStream<T>
}

@override
ErrorAndStackTrace? get errorAndStackTrace => null;
Never get errorAndStackTrace =>
throw StateError('This Stream always has no error!');

@override
ValueWrapper<T>? get valueWrapper => _subject.valueWrapper;
ValueWrapper<T> get valueWrapper => _subject.valueWrapper!;
}
9 changes: 8 additions & 1 deletion lib/src/distinct_value_stream.dart
@@ -1,4 +1,5 @@
import 'package:rxdart_ext/rxdart_ext.dart' show NotReplayValueStream;
import 'package:rxdart_ext/rxdart_ext.dart'
show NotReplayValueStream, ValueWrapper;

/// An [Stream] that provides synchronous access to the last emitted item,
/// and two consecutive values are not equal.
Expand All @@ -10,4 +11,10 @@ abstract class DistinctValueStream<T> extends NotReplayValueStream<T> {
/// Default [equals] function.
/// Use '==' operator on the last provided data element.
static bool defaultEquals<T>(T lhs, T rhs) => lhs == rhs;

@override
Never get errorAndStackTrace;

@override
ValueWrapper<T> get valueWrapper;
}
2 changes: 1 addition & 1 deletion pubspec.yaml
@@ -1,6 +1,6 @@
name: distinct_value_connectable_stream
description: Distinct value connectable stream for RxDart, useful for BLoC pattern
version: 1.2.0-nullsafety.1
version: 1.2.0-nullsafety.2
homepage: https://github.com/hoc081098/distinct_value_connectable_stream

environment:
Expand Down
27 changes: 27 additions & 0 deletions test/distinct_value_connectable_stream_test.dart
Expand Up @@ -248,6 +248,33 @@ void main() {
expect(() => stream.refCount(), throwsStateError);
expect(() => stream.autoConnect(), throwsStateError);
});

test('nullable generic type', () {
expect(
Stream<int?>.fromIterable([
null,
1,
2,
null,
3,
4,
4,
null,
null,
]).shareValueDistinct(null),
emitsInOrder(
<dynamic>[
1,
2,
null,
3,
4,
null,
emitsDone,
],
),
);
});
});
}

Expand Down

0 comments on commit 8c57b53

Please sign in to comment.