extension property

String? get extension

Returns the file extension associated with the detected MIME type, if any.

For example:

  • image/pngpng
  • application/pdfpdf

Returns null if no MIME type can be determined or no extension mapping exists.

Implementation

String? get extension {
  final m = mime;
  if (m == null) return null;
  return extensionFromMime(m);
}