44
55library base_client;
66
7+ import 'dart:async' ;
78import 'dart:io' ;
89import 'dart:scalarlist' ;
910import 'dart:uri' ;
@@ -72,7 +73,7 @@ abstract class BaseClient implements Client {
7273 /// For more fine-grained control over the request and response, use [send] or
7374 /// [get] instead.
7475 Future <String > read (url, {Map <String , String > headers}) {
75- return get (url, headers: headers).transform ((response) {
76+ return get (url, headers: headers).then ((response) {
7677 _checkResponseSuccess (url, response);
7778 return response.body;
7879 });
@@ -88,7 +89,7 @@ abstract class BaseClient implements Client {
8889 /// For more fine-grained control over the request and response, use [send] or
8990 /// [get] instead.
9091 Future <Uint8List > readBytes (url, {Map <String , String > headers}) {
91- return get (url, headers: headers).transform ((response) {
92+ return get (url, headers: headers).then ((response) {
9293 _checkResponseSuccess (url, response);
9394 return response.bodyBytes;
9495 });
@@ -108,15 +109,15 @@ abstract class BaseClient implements Client {
108109 [Map <String , String > fields]) {
109110 // Wrap everything in a Future block so that synchronous validation errors
110111 // are passed asynchronously through the Future chain.
111- return async .chain ((_) {
112+ return async .then ((_) {
112113 if (url is String ) url = new Uri .fromString (url);
113114 var request = new Request (method, url);
114115
115116 if (headers != null ) mapAddAll (request.headers, headers);
116117 if (fields != null && ! fields.isEmpty) request.bodyFields = fields;
117118
118119 return send (request);
119- }).chain (Response .fromStream);
120+ }).then (Response .fromStream);
120121 }
121122
122123 /// Throws an error if [response] is not successful.
0 commit comments