{"id":15697154,"url":"https://github.com/lucjosin/on_audio_room","last_synced_at":"2025-10-07T03:07:50.870Z","repository":{"id":46959532,"uuid":"389675530","full_name":"LucJosin/on_audio_room","owner":"LucJosin","description":"Flutter Package used to create a room to storage audio sections [Favorites, Internal Playlists, Most Played, etc...].","archived":false,"fork":false,"pushed_at":"2022-01-21T16:41:18.000Z","size":247,"stargazers_count":6,"open_issues_count":3,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-08T23:42:35.973Z","etag":null,"topics":["audio-store","dart","flutter","flutter-audio","flutter-null-safety","flutter-package","hive-flutter","on-audio-room","room"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/on_audio_room","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LucJosin.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-07-26T15:10:29.000Z","updated_at":"2024-04-07T09:31:39.000Z","dependencies_parsed_at":"2022-09-07T07:10:38.518Z","dependency_job_id":null,"html_url":"https://github.com/LucJosin/on_audio_room","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/LucJosin/on_audio_room","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucJosin%2Fon_audio_room","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucJosin%2Fon_audio_room/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucJosin%2Fon_audio_room/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucJosin%2Fon_audio_room/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LucJosin","download_url":"https://codeload.github.com/LucJosin/on_audio_room/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucJosin%2Fon_audio_room/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278712733,"owners_count":26032748,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["audio-store","dart","flutter","flutter-audio","flutter-null-safety","flutter-package","hive-flutter","on-audio-room","room"],"created_at":"2024-10-03T19:13:06.231Z","updated_at":"2025-10-07T03:07:50.824Z","avatar_url":"https://github.com/LucJosin.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# on_audio_room\n[![Pub.dev](https://img.shields.io/pub/v/on_audio_room?color=9cf\u0026label=Pub.dev\u0026style=flat-square)](https://pub.dev/packages/on_audio_room)\n[![Platforms](https://img.shields.io/badge/Platforms-Android%20%7C%20IOS%20%7C%20Web%20%7C%20MacOs%20%7C%20Linux%20%7C%20Windows-9cf?\u0026style=flat-square)](https://www.android.com/)\n[![Flutter](https://img.shields.io/badge/Language-Flutter%20%7C%20Null--Safety-9cf?logo=flutter\u0026style=flat-square)](https://www.flutter.dev/)\n\n`on_audio_room` is a [Flutter](https://flutter.dev/) Package used to create a \"room\" to storage audio sections [Favorites, Internal Playlists, Most Played, etc...]. \u003cbr\u003e\n\nThis Package works as a \"extension\" to [on_audio_query](https://github.com/LucJosin/on_audio_query) and some methods will require it.\n\n## Help:\n\n**Any problem? [Issues](https://github.com/LucJosin/on_audio_room/issues)** \u003cbr\u003e\n**Any suggestion? [Pull request](https://github.com/LucJosin/on_audio_room/pulls)**\n\n### Translations:\n\nNOTE: Feel free to help with readme translations\n\n* [English](README.md)\n* [Portuguese](README.pt-BR.md)\n\n### Topics:\n\n* [How to Install](#how-to-install)\n* [How to use](#how-to-use)\n* [Examples](#examples)\n* [License](#license)\n\n## How to Install:\nAdd the following code to your `pubspec.yaml`:\n```yaml\ndependencies:\n  on_audio_room: ^2.2.1+1\n```\n\n## Some Features:\n\n* Favorites section\n* Last Played section\n* Most Played section\n* Internal playlists section\n\n## TODO:\n\n* Add better performance for all plugin.\n* Add `[Features]`.\n* Fix bugs.\n\n## How to use:\n\nBefore calling any method you need `init` the room/room's:\n\n```dart\nvoid main() async {\n  //Init only one room.\n  await OnAudioRoom().initRoom(RoomType.FAVORITES); //Add the RoomType. \n  runApp(MaterialApp(home: MyApp()));\n}\n\n//Or\n\nvoid main() async {\n  //Init all the room's.\n  await OnAudioRoom().initRoom(); //Don't add the RoomType.\n  runApp(MaterialApp(home: MyApp()));\n}\n```\n\n**Important:**\n\n  * **This method will ONLY work 100% if you add a async/await, if don't, the widget will load almost in the same time and will throw a error.**\n  * **REMEMBER TO CLOSE THE ROOM'S INSIDE THE DISPOSE.**\n  * **See the [documentation](https://pub.dev/documentation/on_audio_room/latest/on_audio_room/OnAudioRoom/initRoom.html)**\n\n```dart\nOnAudioRoom() // The main method to start using the plugin.\n```\nAll types of methods on this plugin:\n\n### Room methods\n\n|  Methods  |   Parameters   |   Return   |\n|--------------|-----------------|-----------------|\n| [`initRoom`]() | `(RoomType, SubDir?)` | `bool` | \u003cbr\u003e\n| [`closeRoom`]() |  | `bool` | \u003cbr\u003e\n| [`deleteRoomFile`]() |  | `bool` | \u003cbr\u003e\n| [`getRoomInfo`]() |  | `RoomEntity` | \u003cbr\u003e\n| [`clearAll`]() |  | `bool` | \u003cbr\u003e\n\n### Global methods\n\n|  Methods  |   Parameters   |   Return   |\n|--------------|-----------------|-----------------|\n| [`addTo`]() | `(RoomType, Entity, PlaylistKey?)` | `int?` | \u003cbr\u003e\n| [`addAllTo`]() | `(RoomType, Entity, PlaylistKey?)` | `List\u003cint\u003e` | \u003cbr\u003e\n| [`updateRoom`]() | `(RoomType, Entity)` | `bool` | \u003cbr\u003e\n| [`deleteFrom`]() | `(RoomType, EntityKey, PlaylistKey?)` | `bool` | \u003cbr\u003e\n| [`deleteAllFrom`]() | `(RoomType, EntityKeys, PlaylistKey?)` | `bool` | \u003cbr\u003e\n| [`clearRoom`]() | `(RoomType)` | `bool` | \u003cbr\u003e\n| [`checkIn`]() | `(RoomType, EntityKey, PlaylistKey?)` | `bool` | \u003cbr\u003e\n\n### Query methods\n\n|  Methods  |   Parameters   |   Return   |\n|--------------|-----------------|-----------------|\n| [`queryFromFavorites`]() | `(EntityKey)` | `FavoritesEntity` | \u003cbr\u003e\n| [`queryFavorites`]() | `(Limit?, Reverse?, RoomSortType?)` | `List\u003cFavoritesEntity\u003e` | \u003cbr\u003e\n| [`queryFromLastPlayed`]() | `(EntityKey)` | `LastPlayedEntity` | \u003cbr\u003e\n| [`queryLastPlayed`]() | `(Limit?, Reverse?, RoomSortType?)` | `List\u003cLastPlayedEntity\u003e` | \u003cbr\u003e\n| [`queryFromMostPlayed`]() | `(EntityKey)` | `MostPlayedEntity` | \u003cbr\u003e\n| [`queryMostPlayed`]() | `(Limit?, Reverse?, RoomSortType?)` | `List\u003cMostPlayedEntity\u003e` | \u003cbr\u003e\n| [`queryFromPlaylist`]() | `(PlaylistKey, EntityKey)` | `SongEntity` | \u003cbr\u003e\n| [`queryAllFromPlaylist`]() | `(PlaylistKey, Limit?, Reverse?, RoomSortType?)` | `List\u003cSongEntity\u003e` | \u003cbr\u003e\n\n### Playlist methods\n\n|  Methods  |   Parameters   |   Return   |\n|--------------|-----------------|-----------------|\n| [`createPlaylist`]() | `(PlaylistName)` | `int?` | \u003cbr\u003e\n| [`deletePlaylist`]() | `(PlaylistKey)` | `bool` | \u003cbr\u003e\n| [`renamePlaylist`]() | `(PlaylistKey, NewName)` | `bool` | \u003cbr\u003e\n| [`clearPlaylists`]() |  | `bool` | \u003cbr\u003e\n| [`queryPlaylist`]() | `(PlaylistKey)` | `PlaylistEntity` | \u003cbr\u003e\n| [`queryPlaylists`]() | `(Limit?, Reverse?)` | `List\u003cPlaylistEntity\u003e` | \u003cbr\u003e\n\n## Examples:\n\n**All examples will use [on_audio_query] plugin to get songs/audios information**\n\n#### addTo\n```dart\n  //If you use [on_audio_query] just extend SongModel to create any entity.\n  someName() async {\n    //The return will be the song id inside the room.\n    int? addToResult = await OnAudioRoom().addTo(\n      RoomType.FAVORITES, \n      entity[index].getMap.toFavoritesEntity(),\n    );\n  }\n\n  //If you don't use [on_audio_query] just create a map with all information.\n  someOtherName() async {\n    Map\u003cdynamic, dynamic\u003e favoritesEntity = {\n      \"_data\": song.data,\n      \"_display_name\": song.displayName,\n      \"_id\": song.id,\n      \"album\": song.album,\n      \"album_id\": song.albumId,\n      \"artist\": song.artist,\n      \"artist_id\": song.artistId,\n      \"date_added\": song.dateAdded,\n      \"duration\": song.duration,\n      \"title\": song.title,\n      \"artwork\": song.artwork,\n    };\n\n    //Now, add to the room\n    //The return will be the song key inside the room.\n    int? addToResult = await OnAudioRoom().addTo(\n      RoomType.FAVORITES, \n      favoritesEntity.toFavoritesEntity(),\n    ); \n  }\n```\n\n#### addAllTo\n```dart\n  //If you use [on_audio_query] just extend SongModel to create any entity.\n  someName() async {\n    //Create a list with all SongModel.\n    List\u003cSongModel\u003e listOfSongs;\n    List\u003cdynamic\u003e listOfEntities;\n    \n    //Add all songs from model to entity.\n    listOfSongs.forEach(element) {\n      listOfEntities.add(element.getMap.toFavoritesEntity());\n    }\n\n    //Now, add to the room.\n    //The return will be a list of song id inside the room.\n    List\u003cint\u003e addAllToResult = await OnAudioRoom().addAllTo(\n      RoomType.FAVORITES, \n      listOfEntities,\n      //playlistKey,\n    );\n  }\n\n  //If you don't use [on_audio_query] just create a list of map with all information.\n  someOtherName() async {\n    List\u003cdynamic\u003e listOfEntities;\n\n    listOfSongs.forEach(element) {\n      Map\u003cdynamic, dynamic\u003e favoritesEntity = {\n      \"last_data\": song.data,\n      \"display_name\": song.displayName,\n      \"id\": song.id,\n      \"album\": song.album,\n      \"album_id\": song.albumId,\n      \"artist\": song.artist,\n      \"artist_id\": song.artistId,\n      \"date_added\": song.dateAdded,\n      \"duration\": song.duration,\n      \"title\": song.title,\n      \"artwork\": song.artwork,\n      };\n\n      listOfEntities.add(favoritesEntity.toFavoritesEntity());\n    }\n\n    //Now, add to the room\n    //The return will be a list of song id inside the room.\n    List\u003cint\u003e addAllToResult = await OnAudioRoom().addAllTo(\n      RoomType.FAVORITES, \n      favoritesEntity,\n      //playlistKey,\n    ); \n  }\n```\n\n#### deleteFrom\n```dart\n  someName() async {\n    //The return will be [true] if song has been deleted or [false] if not.\n    bool deleteFromResult = await OnAudioRoom().deleteFrom(\n      RoomType.FAVORITES,\n      EntityKey,\n      //playlistKey,\n    );\n  }\n\n  //When [Adding/Deleting/Checking] songs from a playlist, remember to add the\n  //[PlaylistKey] or you'll get a exception.\n  someName() async {\n    //The return will be [true] if song has been deleted or [false] if not.\n    bool deleteFromResult = await OnAudioRoom().deleteFrom(\n      RoomType.PLAYLIST,\n      EntityKey,\n      PlaylistKey: PlaylistKey,\n    );\n  }\n```\n\n#### deleteAllFrom\n```dart\n  someName() async {\n    List\u003cint\u003e listOfKeysToDelete = [...];\n    //The return will be [true] if all songs has been deleted or [false] if not.\n    bool deleteAllFromResult = await OnAudioRoom().deleteAllFrom(\n      RoomType.FAVORITES,\n      listOfKeysToDelete,\n      //playlistKey,\n    );\n  }\n```\n\n#### clearRoom\n```dart\n  //This one it's pretty simple.\n  someName() async {\n    //The return will be [true] if all songs has been deleted or [false] if not.\n    bool deleteAllFromResult = await OnAudioRoom().clearRoom(\n      RoomType.FAVORITES,\n      //playlistKey,\n    );\n  }\n```\n\n#### checkIn\n```dart\n  //You'll use this one to check if some song has already been added.\n  //Why? If you try to add the same song twice, will work. To avoid this, check if exist.\n  someName() async {\n    //The return will be [true] if song has already been added or [false] if not.\n    bool checkInResult = await OnAudioRoom().checkIn(\n      RoomType.FAVORITES,\n      EntityKey,\n      //playlistKey,\n    );\n  }\n```\n\n#### queryFromFavorites\n```dart\n  someName() async {\n    //With this method you will define a key and will return all information\n    //about this favorite song.\n    FavoritesEntity? queryFromResult = await OnAudioRoom().queryFromFavorites(\n      EntityKey,\n    );\n  }\n```\n\n#### queryFavorites\n```dart\n  someName() async {\n    //With this method you will get all songs with all information based on Type[Entity].\n    //\n    //You can add a [int] as parameter to define how much song will return from this query.\n    //You can add a [bool] as parameter to define if list will be reversed or no.\n    //You can add a [RoomSortType] as parameter to define the list sort type.\n    List\u003cFavoritesEntity\u003e queryResult = await OnAudioRoom().queryFavorites(\n      100, //Default: 50\n      true, //Default: false\n      RoomSortType.TITLE //Default: null\n    );\n  }\n```\n\n## LICENSE:\n\n* [LICENSE](https://github.com/LucJosin/on_audio_room/blob/main/LICENSE)\n\n\u003e * [Back to top](#on_audio_room)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucjosin%2Fon_audio_room","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flucjosin%2Fon_audio_room","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucjosin%2Fon_audio_room/lists"}