text property

  1. @override
Future<String> text
override

Reads content body as text and returns a future of String.

Implementation

@override
Future<String> get text async {
  try {
    final res = response;
    if (res is http.StreamedResponse) {
      return await res.stream.bytesToString();
    } else {
      return (res as http.Response).body;
    }
  } on Exception catch (e) {
    throw ClientException.readingTextFailed(e);
  }
}