getContentType static method

String? getContentType({
  1. required BuildContext context,
  2. Map<String, String>? headers,
})

Get content type from headers. It looks for json and if it can't find it, it will return unknown content type.

Implementation

static String? getContentType({
  required BuildContext context,
  Map<String, String>? headers,
}) {
  if (headers != null) {
    if (headers.containsKey(_jsonContentTypeSmall)) {
      return headers[_jsonContentTypeSmall];
    }
    if (headers.containsKey(_jsonContentTypeBig)) {
      return headers[_jsonContentTypeBig];
    }
  }
  return context.i18n(AliceTranslationKey.unknown);
}