How spotiflacapp/spotiflac-mobile works
1. Repository shape
- This is a cross-platform Flutter mobile app with native Android and iOS host projects, plus a substantial Go backend under go_backend.
- The app is packaged for Android, iOS, and likely alternative distribution channels via apps.json and GitHub release workflows.
2. Primary UI layer
- lib/screens contains the user-facing flows: home, search, queue, repo/store, album/artist/playlist views, local library views, and a large settings area.
- lib/widgets provides reusable UI building blocks such as cover images, pickers, dialogs, progress views, and settings scaffolding.
- lib/app.dart and lib/main.dart are the app entry points, with main_shell.dart acting as the main navigation container.
3. State management and app orchestration
- lib/providers is the main coordination layer between UI and business logic.
- Providers are split by concern: downloads, playback, search/explore, extensions/store, library collections, local library, recent access, settings, theme, and tracks.
- This suggests a reactive architecture where screens read state from providers and invoke actions that mutate provider-managed state.
4. Core domain models
- lib/models defines the app’s persisted and runtime entities: tracks, download items, settings, and theme settings.
- Generated *.g.dart files indicate codegen-backed serialization/storage for these models.
- These models are used across UI, local databases, and the backend bridge, so they form the main shared contract inside the Flutter layer.
5. Go backend as the heavy-lifting engine
- go_backend is the main non-UI subsystem and appears to implement the download/search/metadata engine.
- It includes providers for external music services such as deezer.go, qobuz.go, and tidal.go, plus lyrics providers and Song.link integration.
- The Go layer also handles metadata extraction, filename generation, duplicates, cover art, CUE parsing, progress reporting, and rate limiting.
6. Extension system
- The extension architecture is a major boundary in the app.
- Files like extension_manager.go, extension_store.go, extension_manifest.go, extension_runtime_*, and extension_provider* indicate a plugin runtime that loads external extensions, exposes auth/http/file/storage helpers, and mediates provider priority.
- The Flutter side has corresponding UI for browsing, installing, configuring, and prioritizing extensions under the Store and Settings screens.
7. Download pipeline
- Downloads are coordinated across Flutter providers, the Go backend, and native platform services.
- download_queue_provider.dart, download_request_payload.dart, download_service_picker.dart, and DownloadService.kt indicate a queued download flow with platform-specific execution support.
- The system likely resolves track metadata, selects a provider/extension, fetches audio and artwork, and writes files through platform-aware storage logic.
8. Local persistence and caches
- Several services manage on-device databases: app_state_database.dart, history_database.dart, library_database.dart, and library_collections_database.dart.
- Caching is explicit for covers and embedded artwork via cover_cache_manager.dart and downloaded_embedded_cover_resolver.dart.
- This implies offline-first behavior for library browsing, recent access, and download history.
9. Platform bridge and native concerns
- platform_bridge.dart is the boundary between Flutter and platform-specific capabilities.
- Native Android code includes MainActivity.kt and DownloadService.kt; iOS has AppDelegate.swift plus the Flutter runner project.
- Android resource files for file paths, locale config, and network security config suggest real device integration concerns like file sharing, locale support, and network policy.
10. Library import and scanning
- The app is not only a downloader; it also manages a local music library.
- local_library_scan_prefs.dart, library_scan.go, csv_import_service.dart, and the various library screens show support for scanning folders, importing collections, and organizing tracks/albums/playlists locally.
- These features connect downloaded content back into the app’s browsing and playback surfaces.
11. Playback, notifications, and sharing
- playback_provider.dart coordinates in-app playback state, while notification_service.dart and share_intent_service.dart handle mobile OS interactions.
- shell_navigation_service.dart suggests cross-screen navigation is also abstracted for use outside direct widget context.
- These services are infrastructure-like and keep platform behavior out of presentation code.
12. Settings, onboarding, and operational controls
- The settings area is unusually broad: appearance, download behavior, provider priorities, lyrics/metadata priorities, extension settings, cache management, logs, and about/donate pages.
- setup_screen.dart and tutorial_screen.dart indicate first-run onboarding, likely for repository URL entry and initial configuration.
- This section acts as the control plane for how the engine behaves.
13. Internationalization and theming
- The app is localized through lib/l10n with many generated language files and ARB sources.
- Theme handling is separated into theme/ plus dynamic color support, so UI appearance is a first-class subsystem rather than ad hoc styling.
14. Build, release, and distribution
- GitHub Actions handle release tagging and GitHub Pages documentation deployment.
- site/ contains hosted docs/download pages, and scripts/build_ios.sh plus the iOS/Android native projects show this repo produces real mobile binaries rather than just a Dart package.
- apps.json suggests the project also integrates with third-party app stores such as AltStore/SideStore.
15. High-level data flow
- User actions start in Flutter screens, move through providers, then into the Go backend and platform bridge.
- Results return as tracks, metadata, download progress, errors, and cached library updates, which then feed the UI and local databases.
- The main architectural boundary is therefore: presentation/state in Flutter, execution/metadata/provider logic in Go, and device capabilities in native Android/iOS layers.
Main entry points: providers Providers · go_backend Go engine · workflows Release assets · platform_bridge.dart Platform bridge
Components 21
Flutter app
Cross-platform UI, state, persistence, and user flows.
- App entry · Bootstraps the mobile app and app shell.
lib/main.dart - App boot · Initial app wiring, dependencies, and top-level configuration.
lib/app.dart - Main shell · Primary navigation container for the app.
lib/screens/main_shell.dart - Core screens · Home, search, queue, repo/store, library, and media detail screens.
lib/screens - Settings area · Appearance, downloads, provider priorities, cache, logs, and onboarding-related settings screens.
lib/screens/settings - UI widgets · Shared UI building blocks for covers, dialogs, pickers, progress, and settings scaffolding.
lib/widgets - Providers · Reactive coordination layer for downloads, playback, search, extensions, library, settings, and theme.
lib/providers - Domain models · Persisted and runtime entities such as tracks, downloads, settings, and theme state.
lib/models - Local stores · On-device databases and history/state storage used by the Flutter layer.
lib/services - Platform bridge · Flutter boundary for native capabilities like notifications, sharing, file access, and navigation helpers.
lib/services/platform_bridge.dart - Download payload · Structured request data passed into the download pipeline.
lib/services/download_request_payload.dart - Cover cache · Artwork caching and embedded cover resolution for offline media browsing.
lib/services/cover_cache_manager.dart - Theme & locale · Dynamic theming and localized string resources.
lib/theme
Go backend
Download, metadata, provider, and extension engine.
- Go engine · Main execution layer for downloads, metadata, provider access, and extension runtime.
go_backend - Extensions · Extension manager, manifests, runtime helpers, store integration, and provider prioritization.
go_backend/extension_manager.go - Music providers · Built-in and external service adapters for Deezer, Qobuz, Tidal, lyrics, and Song.link.
go_backend/deezer.go - Metadata pipeline · Metadata extraction, filename generation, duplicate checks, cover handling, CUE parsing, and progress reporting.
go_backend/metadata.go - Library scan · Local library scanning and collection import logic.
go_backend/library_scan.go
Native hosts
Android and iOS platform integration layers.
- Android host · Android activity, download service, and resource/configuration layer.
android/app/src/main - iOS host · iOS app delegate, runner project, and platform integration layer.
ios/Runner
Build & release
Packaging, release, and hosted site assets.
- Release assets · GitHub workflows, site pages, scripts, and alternate distribution metadata.
.github/workflows
Connections 24
- App entry → App boot: starts · Entry point initializes the application root.
- App boot → Main shell: hosts · App root mounts the main navigation shell.
- Main shell → Core screens: navigates · Shell routes users into core app flows.
- Main shell → Settings area: opens · Shell exposes the settings/control plane.
- Core screens → Providers: reads/writes · Screens consume provider state and dispatch actions.
- Settings area → Providers: configures · Settings pages mutate provider-managed preferences and priorities.
- Providers → Domain models: uses · Providers exchange typed app state through shared models.
- Providers → Local stores: persists · State changes are written to local stores and history databases.
- Providers → Download payload: builds · Download actions are packaged into request payloads.
- Providers → Platform bridge: invokes · Provider actions reach platform-specific capabilities through the bridge.
- Providers → Go engine: calls · Heavy download and metadata work is delegated to the backend engine.
- Go engine → Extensions: loads · The backend hosts and coordinates extension execution.
- Go engine → Music providers: queries · Backend resolves external music and lyrics sources through adapters.
- Go engine → Metadata pipeline: processes · Audio files and metadata are normalized through the processing pipeline.
- Go engine → Library scan: scans · Backend imports and indexes local music libraries.
- Go engine → Platform bridge: bridges · Backend work depends on device/file capabilities exposed by Flutter host layers.
- Providers → Cover cache: uses · UI state and downloads consult cached cover/artwork assets.
- Providers → Theme & locale: renders with · UI presentation is controlled by theming and localization.
- Android host → Platform bridge: implements · Android exposes native services used by the Flutter layer.
- iOS host → Platform bridge: implements · iOS exposes native services used by the Flutter layer.
- Release assets → Android host: packages · Release tooling builds Android binaries and distribution artifacts.
- Release assets → iOS host: packages · Release tooling builds iOS binaries and distribution artifacts.
- Release assets → Go engine: builds · Release workflows include the Go backend in app builds.
- Release assets → Theme & locale: publishes · Docs and release assets support shipped app variants and localized content.