| 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 part of dart.async; | 5 part of dart.async; |
| 6 | 6 |
| 7 // ------------------------------------------------------------------- | 7 // ------------------------------------------------------------------- |
| 8 // Core Stream types | 8 // Core Stream types |
| 9 // ------------------------------------------------------------------- | 9 // ------------------------------------------------------------------- |
| 10 | 10 |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 bool first = true; | 395 bool first = true; |
| 396 subscription = this.listen( | 396 subscription = this.listen( |
| 397 (T element) { | 397 (T element) { |
| 398 if (!first) { | 398 if (!first) { |
| 399 buffer.write(separator); | 399 buffer.write(separator); |
| 400 } | 400 } |
| 401 first = false; | 401 first = false; |
| 402 try { | 402 try { |
| 403 buffer.write(element); | 403 buffer.write(element); |
| 404 } catch (e, s) { | 404 } catch (e, s) { |
| 405 _cancelAndError(subscription, result, _asyncError(e, s), s); | 405 _cancelAndError(subscription, result, e, s); |
| 406 } | 406 } |
| 407 }, | 407 }, |
| 408 onError: (e) { | 408 onError: (e) { |
| 409 result._completeError(e); | 409 result._completeError(e); |
| 410 }, | 410 }, |
| 411 onDone: () { | 411 onDone: () { |
| 412 result._complete(buffer.toString()); | 412 result._complete(buffer.toString()); |
| 413 }, | 413 }, |
| 414 cancelOnError: true); | 414 cancelOnError: true); |
| 415 return result; | 415 return result; |
| (...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1223 * | 1223 * |
| 1224 * If you need to stop listening for values before the stream iterator is | 1224 * If you need to stop listening for values before the stream iterator is |
| 1225 * automatically closed, you must call [cancel] to ensure that the stream | 1225 * automatically closed, you must call [cancel] to ensure that the stream |
| 1226 * is properly closed. | 1226 * is properly closed. |
| 1227 * | 1227 * |
| 1228 * Returns a future if the cancel-operation is not completed synchronously. | 1228 * Returns a future if the cancel-operation is not completed synchronously. |
| 1229 * Otherwise returns `null`. | 1229 * Otherwise returns `null`. |
| 1230 */ | 1230 */ |
| 1231 Future cancel(); | 1231 Future cancel(); |
| 1232 } | 1232 } |
| OLD | NEW |