Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1472)

Unified Diff: sdk/lib/async/stream_impl.dart

Issue 11953103: Add public-facing method and class that allows intercepting stream events. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Added more documentation Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sdk/lib/async/stream_impl.dart
diff --git a/sdk/lib/async/stream_impl.dart b/sdk/lib/async/stream_impl.dart
index 28c41b09804e7a687f9499462aff565652e2a6a2..caa6318f858c0f99bba21171566e28340c6f4e0d 100644
--- a/sdk/lib/async/stream_impl.dart
+++ b/sdk/lib/async/stream_impl.dart
@@ -62,10 +62,10 @@ abstract class _StreamImpl<T> extends Stream<T> {
// ------------------------------------------------------------------
// Stream interface.
- StreamSubscription listen(void onData(T data),
- { void onError(AsyncError error),
- void onDone(),
- bool unsubscribeOnError }) {
+ StreamSubscription<T> listen(void onData(T data),
+ { void onError(AsyncError error),
+ void onDone(),
+ bool unsubscribeOnError }) {
if (_isComplete) {
return new _DoneSubscription(onDone);
}
@@ -73,7 +73,7 @@ abstract class _StreamImpl<T> extends Stream<T> {
if (onError == null) onError = _nullErrorHandler;
if (onDone == null) onDone = _nullDoneHandler;
unsubscribeOnError = identical(true, unsubscribeOnError);
- _StreamListener subscription =
+ _StreamSubscriptionImpl subscription =
_createSubscription(onData, onError, onDone, unsubscribeOnError);
_addListener(subscription);
return subscription;
@@ -1092,8 +1092,10 @@ class _DoneSubscription<T> implements StreamSubscription<T> {
bool get _isComplete => _timer == null && _pauseCount == 0;
void onData(void handleAction(T value)) {}
- void onError(void handleError(StateError error)) {}
- void onDone(void handleDone(T value)) {
+
+ void onError(void handleError(AsyncError error)) {}
+
+ void onDone(void handleDone()) {
_handler = handleDone;
}

Powered by Google App Engine
This is Rietveld 408576698