ofFile static method

Future<MediaType?> ofFile(
  1. FileSystemEntity file, {
  2. List<String> mediaTypes = const [],
  3. List<String> fileExtensions = const [],
  4. List<Sniffer> sniffers = MediaType.sniffers,
})

Resolves a format from a local file path.

Implementation

static Future<MediaType?> ofFile(FileSystemEntity file,
        {List<String> mediaTypes = const [],
        List<String> fileExtensions = const [],
        List<Sniffer> sniffers = MediaType.sniffers}) =>
    _of(
        content: SnifferFileContent(file),
        mediaTypes: mediaTypes,
        fileExtensions: [file.path.extension(), ...fileExtensions],
        sniffers: sniffers);