refactor: dispatch on MusicServices constants instead of raw service ids

Service ids ('deezer', 'tidal', 'qobuz', 'spotify', 'amazon', 'local')
were compared as raw string literals in every dispatch chain. Introduce
MusicServices constants and use them at the comparison/switch sites so
a typo becomes a compile error instead of a silently dead branch.
This commit is contained in:
zarzet
2026-07-10 10:17:59 +07:00
parent c24a72c302
commit 19f69a6090
6 changed files with 53 additions and 34 deletions
+15
View File
@@ -0,0 +1,15 @@
/// Canonical service / provider identifiers shared across the app.
///
/// These values must stay in sync with the provider ids reported by the Go
/// backend and by extensions; use them instead of raw string literals when
/// comparing or dispatching on a service id.
abstract final class MusicServices {
static const spotify = 'spotify';
static const deezer = 'deezer';
static const tidal = 'tidal';
static const qobuz = 'qobuz';
static const amazon = 'amazon';
/// Pseudo-service for tracks that only exist in the local library.
static const local = 'local';
}