TContentType.fromString constructor

TContentType.fromString(
  1. String value
)

Maps a raw media type value to a supported TContentType.

Falls back to textPlain for unrecognized values.

Implementation

factory TContentType.fromString(String value) {
  switch (value) {
    case "text/plain":
      return textPlain;
    case "application/json":
      return applicationJson;
    case "text/json":
      return textJson;
    case "multipart/form-data":
      return multipartFormData;
    default:
      return textPlain;
  }
}