OLD | NEW |
1 part of dart.async; | 1 part of dart.async; |
2 abstract class Stream<T> {Stream(); | 2 abstract class Stream<T> {Stream(); |
3 factory Stream.fromFuture(Future<T> future) { | 3 factory Stream.fromFuture(Future<T> future) { |
4 _StreamController<T> controller = new StreamController<T>(sync: true); | 4 _StreamController<T> controller = new StreamController<T>(sync: true); |
5 future.then((value) { | 5 future.then((value) { |
6 controller._add(DEVC$RT.cast(value, dynamic, T, "CompositeCast", """line 89,
column 25 of dart:async/stream.dart: """, value is T, false)); | 6 controller._add(DEVC$RT.cast(value, dynamic, T, "CompositeCast", """line 89,
column 25 of dart:async/stream.dart: """, value is T, false)); |
7 controller._closeUnchecked(); | 7 controller._closeUnchecked(); |
8 } | 8 } |
9 , onError: (error, stackTrace) { | 9 , onError: (error, stackTrace) { |
10 controller._addError(error, DEVC$RT.cast(stackTrace, dynamic, StackTrace, "D
ynamicCast", """line 93, column 37 of dart:async/stream.dart: """, stackTrace is
StackTrace, true)); | 10 controller._addError(error, DEVC$RT.cast(stackTrace, dynamic, StackTrace, "D
ynamicCast", """line 93, column 37 of dart:async/stream.dart: """, stackTrace is
StackTrace, true)); |
11 controller._closeUnchecked(); | 11 controller._closeUnchecked(); |
12 } | 12 } |
13 ); | 13 ); |
14 return controller.stream; | 14 return controller.stream; |
15 } | 15 } |
16 factory Stream.fromIterable(Iterable<T> data) { | 16 factory Stream.fromIterable(Iterable<T> data) { |
17 return new _GeneratedStreamImpl<T>(() => new _IterablePendingEvents<T>(data)); | 17 return new _GeneratedStreamImpl<T>(() => new _IterablePendingEvents<T>(data)); |
18 } | 18 } |
19 factory Stream.periodic(Duration period, [T computation(int computationCount)])
{ | 19 factory Stream.periodic(Duration period, [T computation(int computationCount)])
{ |
20 if (computation == null) computation = ((__x23) => DEVC$RT.cast(__x23, __t21,
DEVC$RT.type((__t19<T> _) { | 20 if (computation == null) computation = ((__x23) => DEVC$RT.cast(__x23, __CastT
ype21, DEVC$RT.type((__CastType19<T> _) { |
21 } | 21 } |
22 ), "CompositeCast", """line 126, column 44 of dart:async/stream.dart: """, __x
23 is __t19<T>, false))(((i) => null)); | 22 ), "CompositeCast", """line 126, column 44 of dart:async/stream.dart: """, __x
23 is __CastType19<T>, false))(((i) => null)); |
23 Timer timer; | 23 Timer timer; |
24 int computationCount = 0; | 24 int computationCount = 0; |
25 StreamController<T> controller; | 25 StreamController<T> controller; |
26 Stopwatch watch = new Stopwatch(); | 26 Stopwatch watch = new Stopwatch(); |
27 void sendEvent() { | 27 void sendEvent() { |
28 watch.reset(); | 28 watch.reset(); |
29 T data = computation(computationCount++); | 29 T data = computation(computationCount++); |
30 controller.add(data); | 30 controller.add(data); |
31 } | 31 } |
32 void startPeriodicTimer() { | 32 void startPeriodicTimer() { |
(...skipping 22 matching lines...) Expand all Loading... |
55 ); | 55 ); |
56 } | 56 } |
57 , onCancel: () { | 57 , onCancel: () { |
58 if (timer != null) timer.cancel(); | 58 if (timer != null) timer.cancel(); |
59 timer = null; | 59 timer = null; |
60 } | 60 } |
61 ); | 61 ); |
62 return controller.stream; | 62 return controller.stream; |
63 } | 63 } |
64 factory Stream.eventTransformed(Stream source, EventSink mapSink(EventSink<T> s
ink)) { | 64 factory Stream.eventTransformed(Stream source, EventSink mapSink(EventSink<T> s
ink)) { |
65 return new _BoundSinkStream<dynamic, T>(source, DEVC$RT.cast(mapSink, DEVC$RT.
type((__t24<T> _) { | 65 return new _BoundSinkStream<dynamic, T>(source, DEVC$RT.cast(mapSink, DEVC$RT.
type((__CastType24<T> _) { |
66 } | 66 } |
67 ), DEVC$RT.type((_SinkMapper<dynamic, dynamic> _) { | 67 ), DEVC$RT.type((_SinkMapper<dynamic, dynamic> _) { |
68 } | 68 } |
69 ), "CompositeCast", """line 216, column 41 of dart:async/stream.dart: """, map
Sink is _SinkMapper<dynamic, dynamic>, false)); | 69 ), "CompositeCast", """line 216, column 41 of dart:async/stream.dart: """, map
Sink is _SinkMapper<dynamic, dynamic>, false)); |
70 } | 70 } |
71 bool get isBroadcast => false; | 71 bool get isBroadcast => false; |
72 Stream<T> asBroadcastStream({ | 72 Stream<T> asBroadcastStream({ |
73 void onListen(StreamSubscription<T> subscription), void onCancel(StreamSubscri
ption<T> subscription)} | 73 void onListen(StreamSubscription<T> subscription), void onCancel(StreamSubscri
ption<T> subscription)} |
74 ) { | 74 ) { |
75 return new _AsBroadcastStream<T>(this, DEVC$RT.cast(onListen, DEVC$RT.type((__
t28<T> _) { | 75 return new _AsBroadcastStream<T>(this, DEVC$RT.cast(onListen, DEVC$RT.type((__
CastType28<T> _) { |
76 } | 76 } |
77 ), __t26, "CompositeCast", """line 248, column 44 of dart:async/stream.dart: "
"", onListen is __t26, false), DEVC$RT.cast(onCancel, DEVC$RT.type((__t28<T> _)
{ | 77 ), __CastType26, "CompositeCast", """line 248, column 44 of dart:async/stream.
dart: """, onListen is __CastType26, false), DEVC$RT.cast(onCancel, DEVC$RT.type
((__CastType28<T> _) { |
78 } | 78 } |
79 ), __t26, "CompositeCast", """line 248, column 54 of dart:async/stream.dart: "
"", onCancel is __t26, false)); | 79 ), __CastType26, "CompositeCast", """line 248, column 54 of dart:async/stream.
dart: """, onCancel is __CastType26, false)); |
80 } | 80 } |
81 StreamSubscription<T> listen(void onData(T event), { | 81 StreamSubscription<T> listen(void onData(T event), { |
82 Function onError, void onDone(), bool cancelOnError} | 82 Function onError, void onDone(), bool cancelOnError} |
83 ); | 83 ); |
84 Stream<T> where(bool test(T event)) { | 84 Stream<T> where(bool test(T event)) { |
85 return new _WhereStream<T>(this, test); | 85 return new _WhereStream<T>(this, test); |
86 } | 86 } |
87 Stream map(convert(T event)) { | 87 Stream map(convert(T event)) { |
88 return new _MapStream<T, dynamic>(this, convert); | 88 return new _MapStream<T, dynamic>(this, convert); |
89 } | 89 } |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 Future<T> reduce(T combine(T previous, T element)) { | 189 Future<T> reduce(T combine(T previous, T element)) { |
190 _Future<T> result = new _Future<T>(); | 190 _Future<T> result = new _Future<T>(); |
191 bool seenFirst = false; | 191 bool seenFirst = false; |
192 T value; | 192 T value; |
193 StreamSubscription subscription; | 193 StreamSubscription subscription; |
194 subscription = this.listen((T element) { | 194 subscription = this.listen((T element) { |
195 if (seenFirst) { | 195 if (seenFirst) { |
196 _runUserCode(() => combine(value, element), (T newValue) { | 196 _runUserCode(() => combine(value, element), (T newValue) { |
197 value = newValue; | 197 value = newValue; |
198 } | 198 } |
199 , ((__x33) => DEVC$RT.cast(__x33, dynamic, __t30, "CompositeCast", """line
501, column 24 of dart:async/stream.dart: """, __x33 is __t30, false))(_cancelA
ndErrorClosure(subscription, result))); | 199 , ((__x33) => DEVC$RT.cast(__x33, dynamic, __CastType30, "CompositeCast",
"""line 501, column 24 of dart:async/stream.dart: """, __x33 is __CastType30, fa
lse))(_cancelAndErrorClosure(subscription, result))); |
200 } | 200 } |
201 else { | 201 else { |
202 value = element; | 202 value = element; |
203 seenFirst = true; | 203 seenFirst = true; |
204 } | 204 } |
205 } | 205 } |
206 , onError: result._completeError, onDone: () { | 206 , onError: result._completeError, onDone: () { |
207 if (!seenFirst) { | 207 if (!seenFirst) { |
208 try { | 208 try { |
209 throw IterableElementError.noElement(); | 209 throw IterableElementError.noElement(); |
(...skipping 10 matching lines...) Expand all Loading... |
220 return result; | 220 return result; |
221 } | 221 } |
222 Future fold(var initialValue, combine(var previous, T element)) { | 222 Future fold(var initialValue, combine(var previous, T element)) { |
223 _Future result = new _Future(); | 223 _Future result = new _Future(); |
224 var value = initialValue; | 224 var value = initialValue; |
225 StreamSubscription subscription; | 225 StreamSubscription subscription; |
226 subscription = this.listen((T element) { | 226 subscription = this.listen((T element) { |
227 _runUserCode(() => combine(value, element), (newValue) { | 227 _runUserCode(() => combine(value, element), (newValue) { |
228 value = newValue; | 228 value = newValue; |
229 } | 229 } |
230 , ((__x34) => DEVC$RT.cast(__x34, dynamic, __t30, "CompositeCast", """line 5
34, column 11 of dart:async/stream.dart: """, __x34 is __t30, false))(_cancelAnd
ErrorClosure(subscription, result))); | 230 , ((__x34) => DEVC$RT.cast(__x34, dynamic, __CastType30, "CompositeCast", ""
"line 534, column 11 of dart:async/stream.dart: """, __x34 is __CastType30, fals
e))(_cancelAndErrorClosure(subscription, result))); |
231 } | 231 } |
232 , onError: (e, st) { | 232 , onError: (e, st) { |
233 result._completeError(e, DEVC$RT.cast(st, dynamic, StackTrace, "DynamicCast"
, """line 538, column 34 of dart:async/stream.dart: """, st is StackTrace, true)
); | 233 result._completeError(e, DEVC$RT.cast(st, dynamic, StackTrace, "DynamicCast"
, """line 538, column 34 of dart:async/stream.dart: """, st is StackTrace, true)
); |
234 } | 234 } |
235 , onDone: () { | 235 , onDone: () { |
236 result._complete(value); | 236 result._complete(value); |
237 } | 237 } |
238 , cancelOnError: true); | 238 , cancelOnError: true); |
239 return result; | 239 return result; |
240 } | 240 } |
(...skipping 25 matching lines...) Expand all Loading... |
266 } | 266 } |
267 Future<bool> contains(Object needle) { | 267 Future<bool> contains(Object needle) { |
268 _Future<bool> future = new _Future<bool>(); | 268 _Future<bool> future = new _Future<bool>(); |
269 StreamSubscription subscription; | 269 StreamSubscription subscription; |
270 subscription = this.listen((T element) { | 270 subscription = this.listen((T element) { |
271 _runUserCode(() => (element == needle), (bool isMatch) { | 271 _runUserCode(() => (element == needle), (bool isMatch) { |
272 if (isMatch) { | 272 if (isMatch) { |
273 _cancelAndValue(subscription, future, true); | 273 _cancelAndValue(subscription, future, true); |
274 } | 274 } |
275 } | 275 } |
276 , ((__x35) => DEVC$RT.cast(__x35, dynamic, __t30, "CompositeCast", """line 6
02, column 13 of dart:async/stream.dart: """, __x35 is __t30, false))(_cancelAnd
ErrorClosure(subscription, future))); | 276 , ((__x35) => DEVC$RT.cast(__x35, dynamic, __CastType30, "CompositeCast", ""
"line 602, column 13 of dart:async/stream.dart: """, __x35 is __CastType30, fals
e))(_cancelAndErrorClosure(subscription, future))); |
277 } | 277 } |
278 , onError: future._completeError, onDone: () { | 278 , onError: future._completeError, onDone: () { |
279 future._complete(false); | 279 future._complete(false); |
280 } | 280 } |
281 , cancelOnError: true); | 281 , cancelOnError: true); |
282 return future; | 282 return future; |
283 } | 283 } |
284 Future forEach(void action(T element)) { | 284 Future forEach(void action(T element)) { |
285 _Future future = new _Future(); | 285 _Future future = new _Future(); |
286 StreamSubscription subscription; | 286 StreamSubscription subscription; |
287 subscription = this.listen((T element) { | 287 subscription = this.listen((T element) { |
288 _runUserCode(() => action(element), (_) { | 288 _runUserCode(() => action(element), (_) { |
289 } | 289 } |
290 , ((__x36) => DEVC$RT.cast(__x36, dynamic, __t30, "CompositeCast", """line 6
28, column 13 of dart:async/stream.dart: """, __x36 is __t30, false))(_cancelAnd
ErrorClosure(subscription, future))); | 290 , ((__x36) => DEVC$RT.cast(__x36, dynamic, __CastType30, "CompositeCast", ""
"line 628, column 13 of dart:async/stream.dart: """, __x36 is __CastType30, fals
e))(_cancelAndErrorClosure(subscription, future))); |
291 } | 291 } |
292 , onError: future._completeError, onDone: () { | 292 , onError: future._completeError, onDone: () { |
293 future._complete(null); | 293 future._complete(null); |
294 } | 294 } |
295 , cancelOnError: true); | 295 , cancelOnError: true); |
296 return future; | 296 return future; |
297 } | 297 } |
298 Future<bool> every(bool test(T element)) { | 298 Future<bool> every(bool test(T element)) { |
299 _Future<bool> future = new _Future<bool>(); | 299 _Future<bool> future = new _Future<bool>(); |
300 StreamSubscription subscription; | 300 StreamSubscription subscription; |
301 subscription = this.listen((T element) { | 301 subscription = this.listen((T element) { |
302 _runUserCode(() => test(element), (bool isMatch) { | 302 _runUserCode(() => test(element), (bool isMatch) { |
303 if (!isMatch) { | 303 if (!isMatch) { |
304 _cancelAndValue(subscription, future, false); | 304 _cancelAndValue(subscription, future, false); |
305 } | 305 } |
306 } | 306 } |
307 , ((__x37) => DEVC$RT.cast(__x37, dynamic, __t30, "CompositeCast", """line 6
57, column 13 of dart:async/stream.dart: """, __x37 is __t30, false))(_cancelAnd
ErrorClosure(subscription, future))); | 307 , ((__x37) => DEVC$RT.cast(__x37, dynamic, __CastType30, "CompositeCast", ""
"line 657, column 13 of dart:async/stream.dart: """, __x37 is __CastType30, fals
e))(_cancelAndErrorClosure(subscription, future))); |
308 } | 308 } |
309 , onError: future._completeError, onDone: () { | 309 , onError: future._completeError, onDone: () { |
310 future._complete(true); | 310 future._complete(true); |
311 } | 311 } |
312 , cancelOnError: true); | 312 , cancelOnError: true); |
313 return future; | 313 return future; |
314 } | 314 } |
315 Future<bool> any(bool test(T element)) { | 315 Future<bool> any(bool test(T element)) { |
316 _Future<bool> future = new _Future<bool>(); | 316 _Future<bool> future = new _Future<bool>(); |
317 StreamSubscription subscription; | 317 StreamSubscription subscription; |
318 subscription = this.listen((T element) { | 318 subscription = this.listen((T element) { |
319 _runUserCode(() => test(element), (bool isMatch) { | 319 _runUserCode(() => test(element), (bool isMatch) { |
320 if (isMatch) { | 320 if (isMatch) { |
321 _cancelAndValue(subscription, future, true); | 321 _cancelAndValue(subscription, future, true); |
322 } | 322 } |
323 } | 323 } |
324 , ((__x38) => DEVC$RT.cast(__x38, dynamic, __t30, "CompositeCast", """line 6
94, column 13 of dart:async/stream.dart: """, __x38 is __t30, false))(_cancelAnd
ErrorClosure(subscription, future))); | 324 , ((__x38) => DEVC$RT.cast(__x38, dynamic, __CastType30, "CompositeCast", ""
"line 694, column 13 of dart:async/stream.dart: """, __x38 is __CastType30, fals
e))(_cancelAndErrorClosure(subscription, future))); |
325 } | 325 } |
326 , onError: future._completeError, onDone: () { | 326 , onError: future._completeError, onDone: () { |
327 future._complete(false); | 327 future._complete(false); |
328 } | 328 } |
329 , cancelOnError: true); | 329 , cancelOnError: true); |
330 return future; | 330 return future; |
331 } | 331 } |
332 Future<int> get length { | 332 Future<int> get length { |
333 _Future<int> future = new _Future<int>(); | 333 _Future<int> future = new _Future<int>(); |
334 int count = 0; | 334 int count = 0; |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 Object defaultValue()} | 468 Object defaultValue()} |
469 ) { | 469 ) { |
470 _Future<dynamic> future = new _Future(); | 470 _Future<dynamic> future = new _Future(); |
471 StreamSubscription subscription; | 471 StreamSubscription subscription; |
472 subscription = this.listen((T value) { | 472 subscription = this.listen((T value) { |
473 _runUserCode(() => test(value), (bool isMatch) { | 473 _runUserCode(() => test(value), (bool isMatch) { |
474 if (isMatch) { | 474 if (isMatch) { |
475 _cancelAndValue(subscription, future, value); | 475 _cancelAndValue(subscription, future, value); |
476 } | 476 } |
477 } | 477 } |
478 , ((__x39) => DEVC$RT.cast(__x39, dynamic, __t30, "CompositeCast", """line 1
036, column 11 of dart:async/stream.dart: """, __x39 is __t30, false))(_cancelAn
dErrorClosure(subscription, future))); | 478 , ((__x39) => DEVC$RT.cast(__x39, dynamic, __CastType30, "CompositeCast", ""
"line 1036, column 11 of dart:async/stream.dart: """, __x39 is __CastType30, fal
se))(_cancelAndErrorClosure(subscription, future))); |
479 } | 479 } |
480 , onError: future._completeError, onDone: () { | 480 , onError: future._completeError, onDone: () { |
481 if (defaultValue != null) { | 481 if (defaultValue != null) { |
482 _runUserCode(defaultValue, future._complete, future._completeError); | 482 _runUserCode(defaultValue, future._complete, future._completeError); |
483 return;} | 483 return;} |
484 try { | 484 try { |
485 throw IterableElementError.noElement(); | 485 throw IterableElementError.noElement(); |
486 } | 486 } |
487 catch (e, s) { | 487 catch (e, s) { |
488 _completeWithErrorCallback(future, e, s); | 488 _completeWithErrorCallback(future, e, s); |
489 } | 489 } |
490 } | 490 } |
491 , cancelOnError: true); | 491 , cancelOnError: true); |
492 return future; | 492 return future; |
493 } | 493 } |
494 Future<dynamic> lastWhere(bool test(T element), { | 494 Future<dynamic> lastWhere(bool test(T element), { |
495 Object defaultValue()} | 495 Object defaultValue()} |
496 ) { | 496 ) { |
497 _Future<dynamic> future = new _Future(); | 497 _Future<dynamic> future = new _Future(); |
498 T result = null; | 498 T result = null; |
499 bool foundResult = false; | 499 bool foundResult = false; |
500 StreamSubscription subscription; | 500 StreamSubscription subscription; |
501 subscription = this.listen((T value) { | 501 subscription = this.listen((T value) { |
502 _runUserCode(() => true == test(value), (bool isMatch) { | 502 _runUserCode(() => true == test(value), (bool isMatch) { |
503 if (isMatch) { | 503 if (isMatch) { |
504 foundResult = true; | 504 foundResult = true; |
505 result = value; | 505 result = value; |
506 } | 506 } |
507 } | 507 } |
508 , ((__x40) => DEVC$RT.cast(__x40, dynamic, __t30, "CompositeCast", """line 1
077, column 11 of dart:async/stream.dart: """, __x40 is __t30, false))(_cancelAn
dErrorClosure(subscription, future))); | 508 , ((__x40) => DEVC$RT.cast(__x40, dynamic, __CastType30, "CompositeCast", ""
"line 1077, column 11 of dart:async/stream.dart: """, __x40 is __CastType30, fal
se))(_cancelAndErrorClosure(subscription, future))); |
509 } | 509 } |
510 , onError: future._completeError, onDone: () { | 510 , onError: future._completeError, onDone: () { |
511 if (foundResult) { | 511 if (foundResult) { |
512 future._complete(result); | 512 future._complete(result); |
513 return;} | 513 return;} |
514 if (defaultValue != null) { | 514 if (defaultValue != null) { |
515 _runUserCode(defaultValue, future._complete, future._completeError); | 515 _runUserCode(defaultValue, future._complete, future._completeError); |
516 return;} | 516 return;} |
517 try { | 517 try { |
518 throw IterableElementError.noElement(); | 518 throw IterableElementError.noElement(); |
(...skipping 18 matching lines...) Expand all Loading... |
537 throw IterableElementError.tooMany(); | 537 throw IterableElementError.tooMany(); |
538 } | 538 } |
539 catch (e, s) { | 539 catch (e, s) { |
540 _cancelAndErrorWithReplacement(subscription, future, e, s); | 540 _cancelAndErrorWithReplacement(subscription, future, e, s); |
541 } | 541 } |
542 return;} | 542 return;} |
543 foundResult = true; | 543 foundResult = true; |
544 result = value; | 544 result = value; |
545 } | 545 } |
546 } | 546 } |
547 , ((__x41) => DEVC$RT.cast(__x41, dynamic, __t30, "CompositeCast", """line 1
129, column 11 of dart:async/stream.dart: """, __x41 is __t30, false))(_cancelAn
dErrorClosure(subscription, future))); | 547 , ((__x41) => DEVC$RT.cast(__x41, dynamic, __CastType30, "CompositeCast", ""
"line 1129, column 11 of dart:async/stream.dart: """, __x41 is __CastType30, fal
se))(_cancelAndErrorClosure(subscription, future))); |
548 } | 548 } |
549 , onError: future._completeError, onDone: () { | 549 , onError: future._completeError, onDone: () { |
550 if (foundResult) { | 550 if (foundResult) { |
551 future._complete(result); | 551 future._complete(result); |
552 return;} | 552 return;} |
553 try { | 553 try { |
554 throw IterableElementError.noElement(); | 554 throw IterableElementError.noElement(); |
555 } | 555 } |
556 catch (e, s) { | 556 catch (e, s) { |
557 _completeWithErrorCallback(future, e, s); | 557 _completeWithErrorCallback(future, e, s); |
(...skipping 23 matching lines...) Expand all Loading... |
581 void onTimeout(EventSink sink)} | 581 void onTimeout(EventSink sink)} |
582 ) { | 582 ) { |
583 StreamController controller; | 583 StreamController controller; |
584 StreamSubscription<T> subscription; | 584 StreamSubscription<T> subscription; |
585 Timer timer; | 585 Timer timer; |
586 Zone zone; | 586 Zone zone; |
587 Function timeout; | 587 Function timeout; |
588 void onData(T event) { | 588 void onData(T event) { |
589 timer.cancel(); | 589 timer.cancel(); |
590 controller.add(event); | 590 controller.add(event); |
591 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __t42,
"CompositeCast", """line 1219, column 43 of dart:async/stream.dart: """, timeout
is __t42, false)); | 591 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __CastT
ype42, "CompositeCast", """line 1219, column 43 of dart:async/stream.dart: """,
timeout is __CastType42, false)); |
592 } | 592 } |
593 void onError(error, StackTrace stackTrace) { | 593 void onError(error, StackTrace stackTrace) { |
594 timer.cancel(); | 594 timer.cancel(); |
595 assert (controller is _StreamController || controller is _BroadcastStreamCo
ntroller); var eventSink = controller; | 595 assert (controller is _StreamController || controller is _BroadcastStreamCo
ntroller); var eventSink = controller; |
596 eventSink._addError(error, stackTrace); | 596 eventSink._addError(error, stackTrace); |
597 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __t42,
"CompositeCast", """line 1227, column 43 of dart:async/stream.dart: """, timeout
is __t42, false)); | 597 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __CastT
ype42, "CompositeCast", """line 1227, column 43 of dart:async/stream.dart: """,
timeout is __CastType42, false)); |
598 } | 598 } |
599 void onDone() { | 599 void onDone() { |
600 timer.cancel(); | 600 timer.cancel(); |
601 controller.close(); | 601 controller.close(); |
602 } | 602 } |
603 void onListen() { | 603 void onListen() { |
604 zone = Zone.current; | 604 zone = Zone.current; |
605 if (onTimeout == null) { | 605 if (onTimeout == null) { |
606 timeout = () { | 606 timeout = () { |
607 controller.addError(new TimeoutException("No stream event", timeLimit),
null); | 607 controller.addError(new TimeoutException("No stream event", timeLimit),
null); |
608 } | 608 } |
609 ; | 609 ; |
610 } | 610 } |
611 else { | 611 else { |
612 onTimeout = ((__x45) => DEVC$RT.cast(__x45, ZoneUnaryCallback, __t43, "Com
positeCast", """line 1245, column 21 of dart:async/stream.dart: """, __x45 is __
t43, false))(zone.registerUnaryCallback(onTimeout)); | 612 onTimeout = ((__x45) => DEVC$RT.cast(__x45, ZoneUnaryCallback, __CastType4
3, "CompositeCast", """line 1245, column 21 of dart:async/stream.dart: """, __x4
5 is __CastType43, false))(zone.registerUnaryCallback(onTimeout)); |
613 _ControllerEventSinkWrapper wrapper = new _ControllerEventSinkWrapper(nul
l); | 613 _ControllerEventSinkWrapper wrapper = new _ControllerEventSinkWrapper(nul
l); |
614 timeout = () { | 614 timeout = () { |
615 wrapper._sink = controller; | 615 wrapper._sink = controller; |
616 zone.runUnaryGuarded(onTimeout, wrapper); | 616 zone.runUnaryGuarded(onTimeout, wrapper); |
617 wrapper._sink = null; | 617 wrapper._sink = null; |
618 } | 618 } |
619 ; | 619 ; |
620 } | 620 } |
621 subscription = this.listen(onData, onError: onError, onDone: onDone); | 621 subscription = this.listen(onData, onError: onError, onDone: onDone); |
622 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __t42,
"CompositeCast", """line 1256, column 43 of dart:async/stream.dart: """, timeout
is __t42, false)); | 622 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __CastT
ype42, "CompositeCast", """line 1256, column 43 of dart:async/stream.dart: """,
timeout is __CastType42, false)); |
623 } | 623 } |
624 Future onCancel() { | 624 Future onCancel() { |
625 timer.cancel(); | 625 timer.cancel(); |
626 Future result = subscription.cancel(); | 626 Future result = subscription.cancel(); |
627 subscription = null; | 627 subscription = null; |
628 return result; | 628 return result; |
629 } | 629 } |
630 controller = isBroadcast ? new _SyncBroadcastStreamController(onListen, onCan
cel) : new _SyncStreamController(onListen, () { | 630 controller = isBroadcast ? new _SyncBroadcastStreamController(onListen, onCan
cel) : new _SyncStreamController(onListen, () { |
631 timer.cancel(); | 631 timer.cancel(); |
632 subscription.pause(); | 632 subscription.pause(); |
633 } | 633 } |
634 , () { | 634 , () { |
635 subscription.resume(); | 635 subscription.resume(); |
636 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __t42,
"CompositeCast", """line 1275, column 53 of dart:async/stream.dart: """, timeout
is __t42, false)); | 636 timer = zone.createTimer(timeLimit, DEVC$RT.cast(timeout, Function, __CastT
ype42, "CompositeCast", """line 1275, column 53 of dart:async/stream.dart: """,
timeout is __CastType42, false)); |
637 } | 637 } |
638 , onCancel); | 638 , onCancel); |
639 return controller.stream; | 639 return controller.stream; |
640 } | 640 } |
641 } | 641 } |
642 abstract class StreamSubscription<T> {Future cancel(); | 642 abstract class StreamSubscription<T> {Future cancel(); |
643 void onData(void handleData(T data)); | 643 void onData(void handleData(T data)); |
644 void onError(Function handleError); | 644 void onError(Function handleError); |
645 void onDone(void handleDone()); | 645 void onDone(void handleDone()); |
646 void pause([Future resumeSignal]); | 646 void pause([Future resumeSignal]); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
686 void add(T data) { | 686 void add(T data) { |
687 _sink.add(data); | 687 _sink.add(data); |
688 } | 688 } |
689 void addError(error, [StackTrace stackTrace]) { | 689 void addError(error, [StackTrace stackTrace]) { |
690 _sink.addError(error, stackTrace); | 690 _sink.addError(error, stackTrace); |
691 } | 691 } |
692 void close() { | 692 void close() { |
693 _sink.close(); | 693 _sink.close(); |
694 } | 694 } |
695 } | 695 } |
696 typedef T __t19<T>(int __u20); | 696 typedef T __CastType19<T>(int __u20); |
697 typedef dynamic __t21(dynamic __u22); | 697 typedef dynamic __CastType21(dynamic __u22); |
698 typedef EventSink<dynamic> __t24<T>(EventSink<T> __u25); | 698 typedef EventSink<dynamic> __CastType24<T>(EventSink<T> __u25); |
699 typedef void __t26(StreamSubscription<dynamic> __u27); | 699 typedef void __CastType26(StreamSubscription<dynamic> __u27); |
700 typedef void __t28<T>(StreamSubscription<T> __u29); | 700 typedef void __CastType28<T>(StreamSubscription<T> __u29); |
701 typedef dynamic __t30(dynamic __u31, StackTrace __u32); | 701 typedef dynamic __CastType30(dynamic __u31, StackTrace __u32); |
702 typedef void __t42(); | 702 typedef void __CastType42(); |
703 typedef void __t43(EventSink<dynamic> __u44); | 703 typedef void __CastType43(EventSink<dynamic> __u44); |
OLD | NEW |