ofBytes static method

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

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

Implementation

static Future<MediaType?> ofBytes(Future<ByteData> Function() bytes,
        {List<String> mediaTypes = const [],
        List<String> fileExtensions = const [],
        List<Sniffer> sniffers = MediaType.sniffers}) =>
    _of(
        content: SnifferBytesContent(bytes),
        mediaTypes: mediaTypes,
        fileExtensions: fileExtensions,
        sniffers: sniffers);