setContentTypeFromExtension method

void setContentTypeFromExtension(
  1. String extension
)

Set the content type from the extension ie. 'pdf'

Implementation

void setContentTypeFromExtension(String extension) {
  final mime = mimeFromExtension(extension);
  if (mime != null) {
    final split = mime.split('/');
    headers.contentType = ContentType(split[0], split[1]);
  }
}