spotify_flutter 0.0.1 copy "spotify_flutter: ^0.0.1" to clipboard
spotify_flutter: ^0.0.1 copied to clipboard

The ultimate solution for developers who want to incorporate Spotify functionality into their Flutter applications. This package provides a simple and efficient way to interact with the Spotify Web AP [...]

This is a library that helps with interfacing with the Spotify Api.

Features #

This package can help you interact with the following sections under the Spotify Api

  • Artists
  • Users
  • Albums
  • Genre
  • Playlist

Getting started #

Get your api keys from Spotify.

The project requires a minimum SDK version on Android of 18.

Add this to your Manifest File on Android.

        <intent-filter android:label="flutter_web_auth">

            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />

            <data android:scheme="[INSERT_YOUR_CALLBACK_SCHEME]" />


        </intent-filter>
    </activity>

Usage #

Authentication: #

Ensure to authenticate first before using any of the methods. Do not forget to add your REDIRECT URI in your spotify dashboard and ensure they are the same as the one used to authenticate.

Hint: Your redirect Uri should be [YOUR_CALL_BACK_SCHEME]://[ANYTHING_YOU_WANT].com

 _authenticate() async {
  final response = await SpotifyApi.instance.authService.authorize(
    redirectUri: '[INSERT_YOUR_REDERICT_URI]',
    clientId: '[INSERT_YOUR_CLIENT_ID]',
    callbackUrlScheme: '[INSERT_YOUR_CALL_BACK_SCHEME]',
    //Optional: A space-separated list of scopes.To see a valid list of scopes check the spotify docs. Example below:
    scope: 'user-read',
    secretKey: '[INSERT_YOUR_SECRET_KEY]',
  );
  response.when(success: (success) {
    //TODO: HANDLE SUCCESS
  }, failure: (failure) {
    //TODO: HANDLE FAILURE.
  });
}

Simple Example #

To get current users profile.

  _getCurrentUserProfile() async {
    final spotifyUserService = SpotifyApi.instance.userService;
    final response = await spotifyUserService.getCurrentUsersProfile();
    response.when(success: (success) {
      print('Users name is ${success.displayName}');
    }, failure: (failure) {
      print('Failed ${failure.message}');
    });
  }

Issues and feedback #

Please file issues, bugs, or feature requests in our issue tracker.

Feel free contribute a change to this plugin by opening a pull request.

4
likes
100
pub points
23%
popularity

Publisher

unverified uploader

The ultimate solution for developers who want to incorporate Spotify functionality into their Flutter applications. This package provides a simple and efficient way to interact with the Spotify Web API, allowing developers to access a vast array of music-related information and functionalities.

Repository (GitHub)
View/report issues

Documentation

API reference

License

unknown (LICENSE)

Dependencies

dio, flutter, flutter_dotenv, flutter_secure_storage, flutter_web_auth, freezed_annotation, intl, json_annotation, pkce, shared_preferences

More

Packages that depend on spotify_flutter