getString method

Future<String> getString(
  1. dynamic url, {
  2. Map<String, String> headers = const {},
  3. bool validate = true,
})

Implementation

Future<String> getString(
  dynamic url, {
  Map<String, String> headers = const {},
  bool validate = true,
}) async {
  final response =
      await get(url is String ? Uri.parse(url) : url, headers: headers);
  if (_closed) throw HttpClientClosedException();

  if (validate) {
    _validateResponse(response, response.statusCode);
  }

  return response.body;
}