Commit d3f5d601 authored by Tim Smart's avatar Tim Smart

Mark some methods as protected

parent 843f7b40
## 1.1.0
- Mark some methods as `@protected`.
## 1.0.1
- `initialValue` now defaults to `null`.
......
......@@ -15,28 +15,10 @@ abstract class BlocStream<State> extends Stream<State> {
BehaviorSubject<State> _subject;
State get value => _subject.value;
@override
bool get isBroadcast => _subject.isBroadcast;
final _closers = <void Function()>[];
void add(State value) {
_subject.add(value);
}
void addError(Object error, [StackTrace stackTrace]) {
_subject.addError(error, stackTrace);
}
// Helper method to reduce boilerplate when composing BLoC's together.
void cancelOnClose(StreamSubscription subscription,
[void Function() onClose]) {
_closers.add(() {
subscription.cancel();
if (onClose != null) onClose();
});
}
@override
StreamSubscription<State> listen(
void Function(State) onData, {
......@@ -52,6 +34,24 @@ abstract class BlocStream<State> extends Stream<State> {
);
}
// Methods for adding data to the _subject
@protected
void add(State value) => _subject.add(value);
@protected
void addError(Object error, [StackTrace stackTrace]) =>
_subject.addError(error, stackTrace);
// Helper method to reduce boilerplate when composing BLoC's together.
final _closers = <void Function()>[];
@protected
void cancelOnClose(StreamSubscription subscription,
[void Function() onClose]) {
_closers.add(() {
subscription.cancel();
if (onClose != null) onClose();
});
}
Observable<State> asObservable() {
return Observable(this);
}
......
name: bloc_stream
description: A simple package that helps you to implement the BLoC pattern in your applications.
version: 1.0.1
version: 1.1.0
homepage: https://gitlab.com/arisechurch/bloc_stream
environment:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment