isAudio property

bool get isAudio

Returns true when the file appears to be an audio file.

Detection is based on MIME type and common filename extensions.

Example:

if (file.isAudio) {
  print('This upload is audio');
}

Implementation

bool get isAudio {
  final mime = contentType.toLowerCase();
  return mime.startsWith('audio/') || ['.mp3', '.wav', '.ogg', '.m4a', '.aac', '.flac'].any((ext) => filename.toLowerCase().endsWith(ext));
}