OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 @patch class Resource { | 5 @patch class Resource { |
6 /* @patch */ const factory Resource(String uri) = _Resource; | 6 @patch const factory Resource(String uri) = _Resource; |
7 } | 7 } |
8 | 8 |
9 class _Resource implements Resource { | 9 class _Resource implements Resource { |
10 final String _location; | 10 final String _location; |
11 | 11 |
12 const _Resource(this._location); | 12 const _Resource(this._location); |
13 | 13 |
14 Uri get uri => Uri.base.resolve(_location); | 14 Uri get uri => Uri.base.resolve(_location); |
15 | 15 |
16 Stream<List<int>> openRead() { | 16 Stream<List<int>> openRead() { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 var str = encoding.decode(bytes); | 59 var str = encoding.decode(bytes); |
60 completer.complete(str); | 60 completer.complete(str); |
61 }, | 61 }, |
62 onError: (e, s) { | 62 onError: (e, s) { |
63 completer.completeError(e,s); | 63 completer.completeError(e,s); |
64 }); | 64 }); |
65 | 65 |
66 return completer.future; | 66 return completer.future; |
67 } | 67 } |
68 } | 68 } |
OLD | NEW |