readString method

Future<String> readString([
  1. Encoding? encoding
])

Reads the content of this subpart as a string.

The optional encoding parameter can be used to override the encoding used. By default, the content-type header of this part will be used, with a fallback to the content-type of the surrounding request and another fallback to utf8 if everything else fails.

Implementation

Future<String> readString([Encoding? encoding]) {
  encoding ??= _encoding ?? _originalRequest.encoding ?? utf8;
  return encoding.decodeStream(this);
}