mediaType property Null safety

MediaType mediaType

Simplified way to retrieve the media type When no content-type header is defined, the media type text/plain is returned

Implementation

MediaType get mediaType {
  final header = getHeaderContentType();
  return header?.mediaType ?? MediaType.textPlain;
}