How anandnet/harmony-music works
Main Components
• UI/Presentation Layer:
• Represented by the “lib/ui” folder, which contains various screens (Home, Player, Search, Settings, Artists, etc.), widgets, and navigation controllers.
• That the UI layer is responsible for rendering views and handling user interactions.
• Domain/Models Layer:
• Shown in the “lib/models” directory (album, artist, playlist, quick picks, etc.).
• These components encapsulate the core data structures that represent music items, playlists, and related entities.
• Service/Business Logic Layer:
• Located in “lib/services”, with modules for audio handling, background tasks, downloading, permission handling, interfacing with Piped (for playlist integrations), and more.
• This layer acts as the intermediary between the UI and the data/persistence layers. Also, it encapsulates external API calls (like youtube_explode_dart for retrieving song URLs).
• Data Persistence/Local Storage:
• The project uses Hive (and hive_flutter) for offline database functionality. Represent this as a “Local Storage / Persistence” component.
• Interactions between the business logic layer and local storage where caching and offline mapping occur.
• Native Bindings & Platform-Specific Code:
• Although much of the UI and business logic are in Dart, there are narrow pockets that handle integrations with Android (in “android” folder and “lib/native_bindings/”) and platform-specific configuration files for iOS, Linux, Windows, and macOS.
• That platform-specific adjustments (like background music handling, Android Auto support, and system tray integration for desktop) extend the core functionality.
• External Services / Third-Party Integrations:
• External APIs and libraries that provide actual streaming services (YouTube content via youtube_explode_dart; audio playback with just_audio, media_kit; background handling via audio_service) should be represented.
• Also mention service dependencies like Piped for playlist integration and LRCLIB for synced lyrics.
Defining Relationships and Interactions
• How the Service layer communicates with the Models to construct data objects and then either fetch data from external APIs or cache locally in Hive.
• For platform-specific components, show an interface or adapter pattern where the uniform business logic layer calls into distinct native implementations (especially for audio playback on different platforms).
Highlighting Architectural Patterns and Design Principles
• That the app follows a layered architecture where presentation, logic, and data are decoupled.
• Separation of concerns between platform-agnostic Flutter code (in lib/) and platform-specific implementations (in android, ios, windows, etc.).
Including Relevant Technologies, Frameworks, and Libraries
• Flutter – the cross-platform UI framework.
• Get (from the pubspec) for state management/dependency injection.
• just_audio, media_kit, and audio_service for audio playback and background handling.
• youtube_explode_dart for content access from YouTube.
• Hive for local data storage.
• Native integration code for handling Android-specific features (e.g., Android Auto, notifications) and corresponding counterparts for desktop and iOS/macOS.