Fetches album cover bytes via the authenticated dio and writes to
<applicationCacheDirectory>/album_covers/<albumId>.jpg. Returns the
local path so MediaItem.artUri can point at a file:// URI — Android's
MediaSession framework fetches artUri itself without our Bearer
header, so a pre-fetched local file is the workaround.
Concurrent callers for the same albumId dedupe to one fetch via an
in-flight Future map. Any failure (network / 4xx / 5xx / disk full /
empty id) returns null without throwing — playback continues with
the system's generic music icon, same UX as today.
No eviction — covers are tiny, OS clears cache when space is tight.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
smoke_test was hanging in pumpAndSettle because real
flutter_secure_storage MethodChannel calls don't resolve in widget
tests (no platform channel registered). Override secureStorageProvider
with a mocktail FlutterSecureStorage that returns null for every read,
so the GoRouter redirect resolves and ServerUrlScreen renders.
player_provider_test second case was crashing because constructing
MinstrelAudioHandler() instantiates just_audio's AudioPlayer, which
calls setMethodCallHandler during construction — that asserts unless
the WidgetsFlutterBinding is initialized. Add
TestWidgetsFlutterBinding.ensureInitialized() at the top of main().
Both are unit-test plumbing fixes; no production code change.
audio_service runs the handler in a background isolate; UI watches
playbackState/mediaItem/queue streams through Riverpod. AndroidManifest
gets the foreground-service media-playback permission; Info.plist gets
UIBackgroundModes=audio. Bearer token attached to stream URLs via
just_audio's per-source headers.