| 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 library json_rpc_2.utils; | |
| 6 | |
| 7 import 'dart:async'; | 5 import 'dart:async'; |
| 8 | 6 |
| 9 import 'package:stack_trace/stack_trace.dart'; | 7 import 'package:stack_trace/stack_trace.dart'; |
| 10 | 8 |
| 11 typedef ZeroArgumentFunction(); | 9 typedef ZeroArgumentFunction(); |
| 12 | 10 |
| 13 /// Like [new Future.sync], but automatically wraps the future in a | 11 /// Like [new Future.sync], but automatically wraps the future in a |
| 14 /// [Chain.track] call. | 12 /// [Chain.track] call. |
| 15 Future syncFuture(callback()) => Chain.track(new Future.sync(callback)); | 13 Future syncFuture(callback()) => Chain.track(new Future.sync(callback)); |
| 16 | 14 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 Future get done => _inner.done; | 77 Future get done => _inner.done; |
| 80 | 78 |
| 81 _MappedStreamSink(this._inner, this._callback); | 79 _MappedStreamSink(this._inner, this._callback); |
| 82 | 80 |
| 83 void add(event) => _inner.add(_callback(event)); | 81 void add(event) => _inner.add(_callback(event)); |
| 84 void addError(error, [StackTrace stackTrace]) => | 82 void addError(error, [StackTrace stackTrace]) => |
| 85 _inner.addError(error, stackTrace); | 83 _inner.addError(error, stackTrace); |
| 86 Future addStream(Stream stream) => _inner.addStream(stream.map(_callback)); | 84 Future addStream(Stream stream) => _inner.addStream(stream.map(_callback)); |
| 87 Future close() => _inner.close(); | 85 Future close() => _inner.close(); |
| 88 } | 86 } |
| OLD | NEW |