SpotifyService class

A service class to interact with Spotify's API, providing methods for authentication, data retrieval, and search functionalities.

Constructors

SpotifyService({required String clientId, required String clientSecret, required String customUriScheme, required String redirectUri, int? localhostPort})

Properties

accessToken String?
getter/setter pair
client ↔ SpotifyOAuth2Client
The OAuth2 client used for handling authentication with Spotify.
latefinal
clientId String
The client ID of your Spotify application.
final
clientSecret String
The client secret of your Spotify application.
final
customUriScheme String
The custom URI scheme for your application.
final
hashCode int
The hash code for this object.
no setterinherited
localhostPort int?
The localhost port, required for Linux and Windows platforms.
final
loggedIn bool
Indicates whether the user is currently logged in.
no setter
redirectUri String
The redirect URI for your Spotify application.
final
refreshToken String?
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
storage → FlutterSecureStorage
Secure storage for saving and retrieving OAuth credentials.
final

Methods

getAlbum(String albumId) Future<AlbumModel?>
Retrieves detailed information about a specific album.
getAlbumTracks(String albumId) Future<List<SimplifiedTrack>>
Retrieves a list of tracks from a specific album.
getArtist(String artistId) Future<Artist?>
Retrieves detailed information about a specific artist.
getPlaylist(String playlistId) Future<PlaylistModel?>
Retrieves detailed information about a specific playlist.
getSimilarArtists(String artistId) Future<List<Artist>>
Retrieves a list of similar artists for a given artist.
getTopAlbums(String artistId) Future<List<SimplifiedAlbum>>
Retrieves a list of an artist's top albums in a specific market.
getTopSingles(String artistId) Future<List<SimplifiedAlbum>>
Retrieves a list of an artist's top singles in a specific market.
getTopTracks(String artistId) Future<List<TrackModel>>
Retrieves a list of an artist's top tracks in a specific market.
getTrack(String trackId) Future<TrackModel?>
Retrieves detailed information about a specific track.
getUser() Future<UserModel?>
Retrieves the current user's profile information.
getUserPlaylists() Future<List<SimplifiedPlaylist>>
Retrieves a list of the current user's playlists.
initialize() Future<void>
Initializes the service, setting up the Dio instance and loading credentials.
login() Future<void>
Initiates the login process using Spotify's OAuth2 authentication.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
Performs a search query on Spotify.
searchAlbums(String query, {String? market, int offset = 0, int limit = 20}) Future<List<SimplifiedAlbum>>
Searches for albums matching the given query.
searchArtists(String query, {String? market, int offset = 0, int limit = 20}) Future<List<Artist>>
Searches for artists matching the given query.
searchPlaylists(String query, {String? market, int offset = 0, int limit = 20}) Future<List<SimplifiedPlaylist>>
Searches for playlists matching the given query.
searchTracks(String query, {String? market, int offset = 0, int limit = 20}) Future<List<TrackModel>>
Searches for tracks matching the given query.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited