getUri method

Future<String> getUri(
  1. Uri url, {
  2. bool readCache = true,
  3. bool writeCache = true,
  4. Duration? ttl,
  5. Map<String, String> headers = const {},
  6. String defaultCharset(
    1. List<int>
    )?,
  7. String forcedCharset(
    1. List<int>
    )?,
})

Implementation

Future<String> getUri(
  Uri url, {
  bool readCache = true,
  bool writeCache = true,
  Duration? ttl,
  Map<String, String> headers = const {},
  String Function(List<int>)? defaultCharset,
  String Function(List<int>)? forcedCharset,
}) async {
  final cachedResp = readCache ? getCache(url, headers) : null;
  if (cachedResp != null) return cachedResp;
  final req = await _client.getUrl(url);
  headers.forEach(req.headers.set);
  return _finishRequest(req, writeCache, defaultCharset, forcedCharset,
      (r) => setCache(url, headers, r, ttl));
}