OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import "dart:async"; | 5 import "dart:async"; |
6 import "package:async/stream_zip.dart"; | 6 |
| 7 import "package:async/async.dart"; |
7 import "package:test/test.dart"; | 8 import "package:test/test.dart"; |
8 | 9 |
9 /// Create an error with the same values as [base], except that it throwsA | 10 /// Create an error with the same values as [base], except that it throwsA |
10 /// when seeing the value [errorValue]. | 11 /// when seeing the value [errorValue]. |
11 Stream streamError(Stream base, int errorValue, error) { | 12 Stream streamError(Stream base, int errorValue, error) { |
12 return base.map((x) => (x == errorValue) ? throw error : x); | 13 return base.map((x) => (x == errorValue) ? throw error : x); |
13 } | 14 } |
14 | 15 |
15 /// Make a [Stream] from an [Iterable] by adding events to a stream controller | 16 /// Make a [Stream] from an [Iterable] by adding events to a stream controller |
16 /// at periodic intervals. | 17 /// at periodic intervals. |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 } else if (ctr == 2) { | 227 } else if (ctr == 2) { |
227 sub.pause(); | 228 sub.pause(); |
228 new Future.delayed(const Duration(milliseconds: 25)).then((_) { | 229 new Future.delayed(const Duration(milliseconds: 25)).then((_) { |
229 sub.resume(); | 230 sub.resume(); |
230 }); | 231 }); |
231 } | 232 } |
232 ctr++; | 233 ctr++; |
233 }, count: 4)); | 234 }, count: 4)); |
234 }); | 235 }); |
235 } | 236 } |
OLD | NEW |