| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 /// Functions go in this file as opposed to lib/src/utils.dart if they need to | 5 /// Functions go in this file as opposed to lib/src/utils.dart if they need to |
| 6 /// be accessible to the transformer-loading isolate. | 6 /// be accessible to the transformer-loading isolate. |
| 7 library pub.asset.utils; | |
| 8 | |
| 9 import 'dart:async'; | 7 import 'dart:async'; |
| 10 | 8 |
| 11 /// A regular expression to match the exception prefix that some exceptions' | 9 /// A regular expression to match the exception prefix that some exceptions' |
| 12 /// [Object.toString] values contain. | 10 /// [Object.toString] values contain. |
| 13 final _exceptionPrefix = new RegExp(r'^([A-Z][a-zA-Z]*)?(Exception|Error): '); | 11 final _exceptionPrefix = new RegExp(r'^([A-Z][a-zA-Z]*)?(Exception|Error): '); |
| 14 | 12 |
| 15 /// Get a string description of an exception. | 13 /// Get a string description of an exception. |
| 16 /// | 14 /// |
| 17 /// Many exceptions include the exception class name at the beginning of their | 15 /// Many exceptions include the exception class name at the beginning of their |
| 18 /// [toString], so we remove that if it exists. | 16 /// [toString], so we remove that if it exists. |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 subscription = callback().listen(controller.add, | 75 subscription = callback().listen(controller.add, |
| 78 onError: controller.addError, | 76 onError: controller.addError, |
| 79 onDone: controller.close); | 77 onDone: controller.close); |
| 80 }, | 78 }, |
| 81 onCancel: () => subscription.cancel(), | 79 onCancel: () => subscription.cancel(), |
| 82 onPause: () => subscription.pause(), | 80 onPause: () => subscription.pause(), |
| 83 onResume: () => subscription.resume(), | 81 onResume: () => subscription.resume(), |
| 84 sync: true); | 82 sync: true); |
| 85 return controller.stream; | 83 return controller.stream; |
| 86 } | 84 } |
| OLD | NEW |