get method

Future<OpenSslHttpResponse> get(
  1. Uri uri, {
  2. Duration timeout = const Duration(seconds: 5),
  3. Map<String, String> headers = const {},
})

Implementation

Future<OpenSslHttpResponse> get(
  Uri uri, {
  Duration timeout = const Duration(seconds: 5),
  Map<String, String> headers = const {},
}) async {
  if (uri.scheme == 'http') {
    return _getHttp(uri, timeout: timeout, headers: headers);
  }
  if (uri.scheme == 'https') {
    return _getHttps(uri, timeout: timeout, headers: headers);
  }
  throw ArgumentError('Unsupported scheme: ${uri.scheme}');
}