readAsString method
Implementation
@override
Future<String> readAsString(Uri uri) async {
switch (uri.scheme) {
case 'data':
return uri.data!.contentAsString();
case 'https':
case 'http':
var v = _cache[uri];
if (v != null && v.key.isAfter(clock.now())) {
return v.value;
}
var r = await _httpClient.get(uri);
_cache[uri] = MapEntry(_localExpire(r), r.body);
return r.body;
default:
throw UnsupportedError(
'Uri\'s with scheme ${uri.scheme} not supported',
);
}
}