getCurrentSourceForMediaType method
- {required MediaType mediaType}
For a given MediaType, return the selected media source. If there is no persisted media source, use the first source in the list.
Implementation
MediaSource getCurrentSourceForMediaType({
required MediaType mediaType,
}) {
MediaSource fallbackSource = mediaSources[mediaType]!.values.first;
String uniqueKey = _preferences.get('current_source/${mediaType.uniqueKey}',
defaultValue: fallbackSource.uniqueKey);
return mediaSources[mediaType]![uniqueKey] ?? fallbackSource;
}