mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-11-21 20:00:49 +01:00
Return-only switch statements in the conversion, MIME, error type, logger and model helpers become switch expressions with the same cases and defaults, and the log summary switch drops redundant breaks.
19 lines
498 B
Dart
19 lines
498 B
Dart
String audioMimeTypeForPath(String filePath) {
|
|
final dotIndex = filePath.lastIndexOf('.');
|
|
if (dotIndex == -1 || dotIndex == filePath.length - 1) {
|
|
return 'audio/*';
|
|
}
|
|
|
|
final ext = filePath.substring(dotIndex + 1).toLowerCase();
|
|
return switch (ext) {
|
|
'flac' => 'audio/flac',
|
|
'm4a' => 'audio/mp4',
|
|
'mp3' => 'audio/mpeg',
|
|
'ogg' => 'audio/ogg',
|
|
'wav' => 'audio/wav',
|
|
'aiff' || 'aif' || 'aifc' => 'audio/aiff',
|
|
'aac' => 'audio/aac',
|
|
_ => 'audio/*',
|
|
};
|
|
}
|