ofBytesWithSingleHint static method

Future<MediaType?> ofBytesWithSingleHint(
  1. Future<ByteData> bytes(), {
  2. String? mediaType,
  3. String? fileExtension,
  4. List<Sniffer> sniffers = MediaType.sniffers,
})

Resolves a format from bytes, e.g. from an HTTP response.

Implementation

static Future<MediaType?> ofBytesWithSingleHint(
        Future<ByteData> Function() bytes,
        {String? mediaType,
        String? fileExtension,
        List<Sniffer> sniffers = MediaType.sniffers}) =>
    ofBytes(bytes,
        mediaTypes: [mediaType].whereNotNull().toList(),
        fileExtensions: [fileExtension].whereNotNull().toList(),
        sniffers: sniffers);