isImage method Null safety

bool isImage()

Returns true if this asset is an image, false otherwise. If the asset does not have any mime-typed format variants, it will assume that it is an image, even if it isn't.

Implementation

bool isImage() {
  final mime = formats.isNotEmpty ? formats.values.first.mime : 'image/jpeg';

  return mime.startsWith('image');
}