{"id":32293047,"url":"https://github.com/brim-borium/spotify_sdk","last_synced_at":"2026-02-22T03:41:30.750Z","repository":{"id":37359365,"uuid":"223777456","full_name":"brim-borium/spotify_sdk","owner":"brim-borium","description":"Flutter Package to connect the spotify sdk","archived":false,"fork":false,"pushed_at":"2025-10-20T00:14:23.000Z","size":9805,"stargazers_count":164,"open_issues_count":29,"forks_count":91,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-12-22T19:44:53.825Z","etag":null,"topics":["hacktoberfest","spotify-sdk"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/spotify_sdk","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brim-borium.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-11-24T16:49:38.000Z","updated_at":"2025-11-11T12:27:06.000Z","dependencies_parsed_at":"2024-06-21T05:44:25.546Z","dependency_job_id":"5f844f6a-efea-48aa-aca5-4cabb24c61cc","html_url":"https://github.com/brim-borium/spotify_sdk","commit_stats":{"total_commits":235,"total_committers":20,"mean_commits":11.75,"dds":0.6808510638297872,"last_synced_commit":"54d12587478c3b49863f80f1d7442c2aa44670e3"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/brim-borium/spotify_sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brim-borium%2Fspotify_sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brim-borium%2Fspotify_sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brim-borium%2Fspotify_sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brim-borium%2Fspotify_sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brim-borium","download_url":"https://codeload.github.com/brim-borium/spotify_sdk/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brim-borium%2Fspotify_sdk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29704418,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-22T03:17:42.375Z","status":"ssl_error","status_checked_at":"2026-02-22T03:17:31.622Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["hacktoberfest","spotify-sdk"],"created_at":"2025-10-23T03:27:50.201Z","updated_at":"2026-02-22T03:41:30.744Z","avatar_url":"https://github.com/brim-borium.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# spotify_sdk\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://pub.dev/packages/spotify_sdk\"\u003e\u003cimg src=\"https://img.shields.io/badge/pub-3.0.2-green\" alt=\"build\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/brim-borium/spotify_sdk\"\u003e\u003cimg src=\"https://img.shields.io/github/stars/brim-borium/spotify_sdk?color=deeppink\" alt=\"build\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/brim-borium/spotify_sdk/blob/main/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/github/license/brim-borium/spotify_sdk?color=blue\" alt=\"build\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n## Description\n\nThis is a flutter package that wraps the native [iOS](https://github.com/spotify/ios-sdk) and [Android](https://github.com/spotify/android-sdk) Spotify \"remote\" SDKs as well as the [Spotify Web Playback SDK](https://developer.spotify.com/documentation/web-playback-sdk/) for web. Since it wraps the native SDKs it has the same features and limitations.\n\n## Setup\n\n### Android\n\nThis package is using both the spotify-app-remote sdk and spotify-auth library. The auth library is needed to get the access token to work with the web api.\n\nFrom the [Spotify Android SDK Quick Start](https://developer.spotify.com/documentation/android/quick-start/). You need two things:\n\n1. Register your app in the [spotify developer portal](https://developer.spotify.com/dashboard/). You also need to create a sha-1 fingerprint and add this and your package name to the app settings on the dashboard as well as a redirect url.\n2. Follow the steps below for either [Option A: Auto setup](#option-a-auto-setup) or [Option B: Manual setup](#option-b-manual-setup-instructions-for-android-studio-42).\n\n#### Option A: Auto setup\n\nUse the provided setup script to automatically download the latest version of the spotify-app-remote sdk from GitHub and setup the gradle files inside your android project. Run the following command in the root folder of your flutter project.\n\n```bash\ndart run spotify_sdk:android_setup\n```\n\nUse the `--help` flag to see all available options.\n\n#### Option B: Manual setup, instructions for Android Studio 4.2+\n\nDownload the current [Spotify Android SDK](https://github.com/spotify/android-sdk/releases). Here you need the `spotify-app-remote-\\*.aar``.\n\nAfter you are all setup you need to add the SDKs `\\*.aar`` file to your Android Project as Module. See the [Spotify Android SDK Quick Start](https://developer.spotify.com/documentation/android/quick-start/) for detailed information.\n\nSince Android Studio 4.2 you need to manually perform these steps in order to add .jar/.aar files:\n\n1. Open the android folder of your flutter project as an Android Studio project\n2. In the android root folder create a single folder for `spotify-app-remote`, place the corresponding aar file and create an empty build.gradle file, like on the screenshot below:\n   ![image](https://user-images.githubusercontent.com/42183561/125422846-24e03bf0-ec7f-409f-b382-0ef2d0213d08.png)\n   \n3.  Content of the `spotify-app-remote/build.gradle` file:\n\n```groovy\nconfigurations.maybeCreate(\"default\")\nartifacts.add(\"default\", file('spotify-app-remote-release-x.x.x.aar'))\n```\n\n4. In the android root folder find `settings.gradle` file, open it and add the following line at the top of the file:\n\n```groovy\ninclude ':spotify-app-remote'\n```\n\n5. In the app/build.gradle add the following to the default config\n\n```groovy\ndefaultConfig {\n        manifestPlaceholders = [redirectSchemeName: \"spotify-sdk\", redirectHostName: \"auth\"]\n        ...\n    }\n```\n\n### iOS\n\nRegister your app in the [spotify developer portal](https://developer.spotify.com/dashboard/). You also need to register your Bundle ID as well as a Redirect URI.\n\nFollow the instructions in the section `Setup the iOS SDK` of [Spotify iOS SDK Quick Start](https://developer.spotify.com/documentation/ios/quick-start/).\n\n### Web\n\n1. Register your app in the [spotify developer portal](https://developer.spotify.com/dashboard/). You need to provide a redirect URL which points to a dedicated page on a website you own.\n\n2. Paste the following onto the webpage, which you linked to in your redirect URL.  \n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003ctitle\u003eAuthenticating Spotify\u003c/title\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n\t\u003cp\u003ePlease wait while we authenticate Spotify...\u003c/p\u003e\n\t\u003cscript type=\"text/javascript\"\u003e\n\t\tif(window.opener) {\n\t\t\twindow.opener.postMessage('?' + window.location.href.split('?')[1], \"*\");\n\t\t} else {\n\t\t\twindow.close();\n\t\t}\n\t\u003c/script\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\n3. Optionally add this to your Flutter app web/index.html to avoid a Javascript `TypeError: r.__extends is not a function` error in development mode.\n\n```html\n\u003cscript src=\"https://sdk.scdn.co/spotify-player.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n  window.onSpotifyWebPlaybackSDKReady = (evt) =\u003e {};\n\u003c/script\u003e\n```\n\n[You need Spotify Premium to access the Web SDK.](https://developer.spotify.com/documentation/web-playback-sdk/quick-start/)\n\n## Usage\n\nTo start using this package first import it in your Dart file.\n\n```dart\nimport 'package:spotify_sdk/spotify_sdk.dart';\n```\n\nTo connect to the Spotify app you can call connectToSpotifyRemote(...) or getAccessToken(...). In both of these methods you need the client id, which you will find in the Spotify developer dashboard and the redirect url you set there for that specific client.\n\n```dart\nawait SpotifySdk.connectToSpotifyRemote(clientId: \"\", redirectUrl: \"\")\n```\n\nSubscribe to `PlayerState` or `PlayerContext` streams only after connecting successfully\n\n```dart\nSpotifySdk.subscribePlayerState();\nSpotifySdk.subscribePlayerContext();\n```\n\nIf you want to use the web api as well you have to use this method to get the access token. \nYou can specify multiple scopes by separating them with a comma \",\" as shown below. For more information on scopes you can refer to [Spotify Authorization Scopes Guide](https://developer.spotify.com/documentation/general/guides/authorization/scopes/)\n\n```dart\nfinal accessToken = await SpotifySdk.getAccessToken(clientId: \"\", redirectUrl: \"\", scope: \"app-remote-control,user-modify-playback-state,playlist-read-private\");\n```\n\nOn Web you can use the token that you get from `getAccessToken(...)` and then pass it to `connectToSpotifyRemote(...)`. This will avoid having to send user through two Spotify OAuth prompts. You should not persist this token, nor supply a different token, because the refresh token is only set interally by `getAccessToken` or `connectToSpotifyRemote`.\n\nOn iOS you can store the token that you get from `getAccessToken(...)` and then pass it to `connectToSpotifyRemote(...)` during the next session. This will avoid having to switch to the Spotify app for establishing the connection. This library does not handle storing the token. It is up to you to persist it wherever you see fit. Keep in mind that this feature is currently quite buggy in the native iOS SDK and has many side effects like random disconnections. Proceed with caution.\n\nOn iOS Spotify starts playing music when attempting connection. This is a default behavior and there is no official way to prevent this with the currently supported authentication flows. You have the option to pass a Spotify URI upon connection or set it to a blank string to play the last played song. There is an undocumented workaround if you don't want music to start playing which is to pass an invalid Spotify URI instead. This is not officially supported by the Spotify SDK or this library and it can fail or stop working at any time!\n\nHave a look [in the example](example/lib/main.dart) for detailed insights on how you can use this package.\n\n### Token Swap\n\nYou can optionally specify \"token swap\" URLs to manage tokens with a backend service that protects your OAuth client secret. For more information refer to the [Spotify Token Swap and Refresh Guide](https://developer.spotify.com/documentation/ios/guides/token-swap-and-refresh/)\n\n```dart\nSpotifySdkPlugin.tokenSwapURL = 'https://example.com/api/spotify/token';\nSpotifySdkPlugin.tokenRefreshURL = 'https://example.com/api/spotify/refresh';\n````\n\nOn web, this package will perform an Authorization Code (without PKCE) flow, then exchange the code and refresh the token with a backend service you run at the URLs provided.\n\nToken Swap is for now \"web only\". While the iOS SDK also supports the \"token swap\", this flow is not yet supported.\n\n### Api\n\n#### Connecting/Authenticating\n\n| Function  | Description| Android | iOS | Web |\n|---|---|---|---|---|\n| connectToSpotifyRemote  | Connects the App to Spotify | ✔ | ✔ | ✔ |\n|  getAccessToken | Gets the Access Token that you can use to work with the [Web Api](https://developer.spotify.com/documentation/web-api/) | ✔ |  ✔ | ✔ |\n|  disconnect | Disconnects the app connection | ✔ |  ✔ | ✔ |\n|  subscribeConnectionStatus | Subscribes to the current player state. | ✔ |  ✔ | 🚧 |\n\n#### Player Api\n\nThe playerApi as described [here](https://spotify.github.io/android-sdk/app-remote-lib/docs/com/spotify/android/appremote/api/PlayerApi.html).\n\n| Function                | Description | Android | iOS | Web |\n|-------------------------|---|--|---|---|\n| getCrossfadeState       | Gets the current crossfade state | ✔ | ✔ | ❌ |\n| getPlayerState          | Gets the current player state |✔ |  ✔ | ✔ |\n| pause                   | Pauses the current track  |✔ | ✔  | ✔ |\n| play                    | Plays the given spotifyUri |✔ |  ✔ | ✔ |\n| playWithStreamType      | Play the given Spotify uri with specific behaviour for that streamtype | 🚧 |  🚧 | 🚧 |\n| queue                   | Queues given spotifyUri |✔ | ✔  | ✔ |\n| resume                  | Resumes the current track |✔ |  ✔ | ✔ |\n| seekTo                  | Seeks the current track to the given position in milliseconds | ✔ | ✔ | 🚧 |\n| seekToRelativePosition  | Adds to the current position of the track the given milliseconds | ✔ | ❌ | 🚧 |\n| setPodcastPlaybackSpeed | Set playback speed for Podcast  | ✔ | 🚧 | 🚧 |\n| setRepeatMode           | Set the repeat mode | ✔ |  ✔ | ✔ |\n| setShuffle              | Set the shuffle mode | ✔ |  ✔ | ✔ |\n| skipNext                | Skips to next track | ✔ | ✔  | ✔ |\n| skipPrevious            | Skips to previous track |✔ |  ✔ | ✔ |\n| skipToIndex             | Skips to track at specified index in album or playlist |✔ |  ✔ | 🚧  |\n| subscribePlayerContext  | Subscribes to the current player context | ✔ | ✔ | ✔ |\n| subscribePlayerState    | Subscribes to the current player state | ✔ | ✔ | ✔ |\n| toggleRepeat            | Cycles through the repeat modes | ✔ |  ✔ | ❌ |\n| toggleShuffle           | Cycles through the shuffle modes | ✔ | ❌ | ❌ |\n\nOn Web, an automatic call to play may not work due to media activation policies which send an error: \"Authentication Error: Browser prevented autoplay due to lack of interaction\". This error is ignored by the SDK so you can still present a button for the user to click to `play` or `resume` to start playback. See the [Web SDK Troubleshooting guide](https://developer.spotify.com/documentation/web-playback-sdk/reference/#troubleshooting) for more details.\n\n#### Images Api\n\nThe imagesApi as described [here](https://spotify.github.io/android-sdk/app-remote-lib/docs/com/spotify/android/appremote/api/ImagesApi.html).\n\n| Function  | Description| Android | iOS | Web |\n|---|---|---|---|---|\n|  getImage | Get the image from the given spotifyUri | ✔ |  ✔ | 🚧 |\n\n#### User Api\n\nThe userApi as described [here](https://spotify.github.io/android-sdk/app-remote-lib/docs/com/spotify/android/appremote/api/UserApi.html).\n\n| Function  | Description| Android | iOS | Web |\n|---|---|---|---|---|\n|  addToLibrary | Adds the given spotifyUri to the users library | ✔ | ✔ | 🚧 |\n|  getCapabilities | Gets the current users capabilities | ✔ | ✔ | 🚧 |\n|  getLibraryState | Gets the current library state | ✔ | ✔ | 🚧 |\n|  removeFromLibrary | Removes the given spotifyUri to the users library | ✔ | ✔ | 🚧 |\n|  subscribeCapabilities |  Subscribes to the current users capabilities | ✔ | 🚧 | 🚧 |\n|  subscribeUserStatus |  Subscribes to  the current users status | ✔ | 🚧 | 🚧 |\n\n#### Connect Api\n\nThe connectApi as described [here](https://spotify.github.io/android-sdk/app-remote-lib/docs/com/spotify/android/appremote/api/ConnectApi.html).\n\n| Function                   | Description                                | Android | iOS | Web |\n|----------------------------|--------------------------------------------|---|---|---|\n| connectDecreaseVolume      | Decrease volume by a step size determined  | 🚧 | 🚧 | 🚧 |\n| connectIncreaseVolume      | Increase volume by a step size determined  | 🚧 | 🚧 | 🚧 |\n| connectSetVolume           | Set a volume on the currently active device | 🚧 | 🚧 | 🚧 |\n| connectSwitchToLocalDevice | Switch to play music on this (local) device | ✔ | 🚧 | 🚧 |\n| subscribeToVolumeState     | Subscribe to volume state                  | 🚧 | 🚧 | 🚧 |\n\n#### Content Api\n\nThe contentApi as described [here](https://spotify.github.io/android-sdk/app-remote-lib/docs/com/spotify/android/appremote/api/ContentApi.html).\n\n| Function  | Description| Android | iOS | Web |\n|---|---|---|---|---|\n| getChildrenOfItem | tbd | 🚧 | 🚧 | 🚧 |\n| getRecommendedContentItems | tbd | 🚧 | 🚧 | 🚧 |\n| playContentItem | tbd | 🚧 | 🚧 | 🚧 |\n\n## Migration \n\n### spotify-auth: moving from locally sourced aar to maven central\n`spotify-auth` SDK is now retrieved via Maven Central instead of being sourced from an AAR file\n* Steps to remove the locally sourced `spotify-auth` SDK:\n   * android/settings.gradle -\u003e remove `':spotify-auth'`\n   * android/spotify-auth/build.gradle -\u003e remove file\n   * android/spotify-auth/spotify-auth-release-x.x.x.aar -\u003e remove file\n\n## Official Spotify Docs\n\n- [Auth](https://spotify.github.io/android-sdk/auth-lib/docs/index.html)\n- [App Remote](https://spotify.github.io/android-sdk/app-remote-lib/docs/index.html)\n- [Web Playback SDK](https://developer.spotify.com/documentation/web-playback-sdk/)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrim-borium%2Fspotify_sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrim-borium%2Fspotify_sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrim-borium%2Fspotify_sdk/lists"}