isJsonMimeType static method

bool isJsonMimeType(
  1. String? contentType
)

Implementation

static bool isJsonMimeType(String? contentType) {
  if (contentType == null) return false;
  final mediaType = MediaType.parse(contentType);
  return mediaType.mimeType == 'application/json' ||
      mediaType.mimeType == 'text/json' ||
      mediaType.subtype.endsWith('+json');
}