@@ -21,24 +21,6 @@ String mapToQuery(Map<String, String> map, {Encoding encoding}) {
21
21
return pairs.map ((pair) => '${pair [0 ]}=${pair [1 ]}' ).join ('&' );
22
22
}
23
23
24
- /// Like [String.split] , but only splits on the first occurrence of the pattern.
25
- ///
26
- /// This will always return an array of two elements or fewer.
27
- ///
28
- /// split1("foo,bar,baz", ","); //=> ["foo", "bar,baz"]
29
- /// split1("foo", ","); //=> ["foo"]
30
- /// split1("", ","); //=> []
31
- List <String > split1 (String toSplit, String pattern) {
32
- if (toSplit.isEmpty) return < String > [];
33
-
34
- var index = toSplit.indexOf (pattern);
35
- if (index == - 1 ) return [toSplit];
36
- return [
37
- toSplit.substring (0 , index),
38
- toSplit.substring (index + pattern.length)
39
- ];
40
- }
41
-
42
24
/// Returns the [Encoding] that corresponds to [charset] .
43
25
///
44
26
/// Returns [fallback] if [charset] is null or if no [Encoding] was found that
@@ -92,51 +74,3 @@ Stream<T> onDone<T>(Stream<T> stream, void onDone()) =>
92
74
sink.close ();
93
75
onDone ();
94
76
}));
95
-
96
- // TODO(nweiz): remove this when issue 7786 is fixed.
97
- /// Pipes all data and errors from [stream] into [sink] . When [stream] is done,
98
- /// [sink] is closed and the returned [Future] is completed.
99
- Future store (Stream stream, EventSink sink) {
100
- var completer = Completer ();
101
- stream.listen (sink.add, onError: sink.addError, onDone: () {
102
- sink.close ();
103
- completer.complete ();
104
- });
105
- return completer.future;
106
- }
107
-
108
- /// Pipes all data and errors from [stream] into [sink] . Completes [Future] once
109
- /// [stream] is done. Unlike [store] , [sink] remains open after [stream] is
110
- /// done.
111
- Future writeStreamToSink (Stream stream, EventSink sink) {
112
- var completer = Completer ();
113
- stream.listen (sink.add,
114
- onError: sink.addError, onDone: () => completer.complete ());
115
- return completer.future;
116
- }
117
-
118
- /// A pair of values.
119
- class Pair <E , F > {
120
- E first;
121
- F last;
122
-
123
- Pair (this .first, this .last);
124
-
125
- @override
126
- String toString () => '($first , $last )' ;
127
-
128
- @override
129
- bool operator == (other) {
130
- if (other is ! Pair ) return false ;
131
- return other.first == first && other.last == last;
132
- }
133
-
134
- @override
135
- int get hashCode => first.hashCode ^ last.hashCode;
136
- }
137
-
138
- /// Configures [future] so that its result (success or exception) is passed on
139
- /// to [completer] .
140
- void chainToCompleter (Future future, Completer completer) {
141
- future.then (completer.complete, onError: completer.completeError);
142
- }
0 commit comments