isText property

bool get isText

Check if response Content-Type is any text type.

Returns true for any Content-Type with primary type 'text' (text/plain, text/html, text/css, etc.).

Example:

expect(response.isText, true); // text/plain, text/html, etc.

Implementation

bool get isText {
  final ct = contentType;
  return ct != null && ct.primaryType == 'text';
}