Musynth offers two ways to curate song collections: Favourites (cross-platform, persisted locally) and Playlists (Android-only, backed by MediaStore). This page covers how each system works, where data lives, and how to use every touch point for adding, removing, and playing from either collection.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/CesarArellano/Music-Player-App/llms.txt
Use this file to discover all available pages before exploring further.
Favourites
How favourites are stored
Favourites are persisted as aList<String> of song IDs in SharedPreferences (via PreferencesRepository.favoriteSongList). On every app launch, FavoritesCubit.initFavorites(allSongs) decodes those IDs back into SongModel instances using an O(n+m) HashMap lookup that runs inside a background Dart Isolate, so the UI thread is never blocked even with thousands of songs.
Toggling a favourite
FavoritesService.toggle is the single entry point for adding or removing a song from favourites:
FavoritesState via the cubit, and writes the updated ID list to SharedPreferences — all synchronously.
Where you can toggle a favourite
| Location | How to toggle |
|---|---|
| Now Playing screen | The heart icon (♥) next to the song title calls FavoritesService.toggle directly on press. |
| Song context menu | The MoreSongOptionsModal header row contains a favourite toggle button, available from any list via long-press or the ⋮ icon. |
| Media notification | The persistent notification exposes a custom favorite action that toggles the currently-playing song while the app is in the background. |
Favourites tab
The Favourites tab (FavoriteScreen) renders the full FavoritesCubit.state.favoriteList. Tapping a song plays the entire favourites collection as PlaylistType.favorites:
The
disabledDeleteButton: true flag is set on the MoreSongOptionsModal when opened from the Favourites tab, so the Delete from device option is hidden (unfavouriting a song does not delete the file).Playlists (Android only)
Creating a playlist
Adding a song to a playlist
- Long-press any song (or tap the ⋮ icon) to open
MoreSongOptionsModal. - Tap Add to playlist.
- Choose the target playlist from the dropdown.
- Tap Add — the app calls
MusicQuerySelector.addToPlaylist(playlistId, song.id)and thenLibraryCubit.refreshPlaylist().
Removing a song from a playlist
FromMoreSongOptionsModal, tap Remove from playlist. Because MediaStore playlist membership rows use their own _ID (not the audio file’s ID), the modal first queries queryAudiosFrom(PLAYLIST, id) and matches by file path before calling removeFromPlaylist:
isPlaylist: true), the Remove from this playlist option removes the song from the currently-viewed playlist directly without requiring a dropdown.
Deleting a playlist
Tap the delete (🗑) icon on a playlist row, or long-press the row. The app callsMusicQuerySelector.removePlaylist(id) and then LibraryCubit.refreshPlaylist(). A snackbar confirms success or reports failure.
Lazy playlist song loading
Playlist song lists are loaded on first visit and cached inLibraryState.playlistCollection. LibraryCubit.searchByPlaylistId(id) is called when a PlaylistSelectedScreen opens:
force: true after any mutation (add/remove song) to bypass the cache.
Comparison
| Feature | Favourites | Playlists |
|---|---|---|
| Platform | iOS + Android | Android only |
| Storage | SharedPreferences (IDs as strings) | Android MediaStore |
| Created by | Toggling the ♥ button | FAB on Playlist tab |
PlaylistType | PlaylistType.favorites | PlaylistType.playlist |
| Persists across reinstalls | No (SharedPreferences cleared) | Yes (MediaStore survives reinstall) |
| Song order | Insertion order | MediaStore order |