SpotifySdk class

SpotifySdk holds the functionality to connect via spotify remote or get an authToken to control the spotify playback and use the functionality described here

Constructors

SpotifySdk()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

isSpotifyAppActive Future<bool>
Checks if the Spotify app is active on the user's device. You can use this to determine if maybe you should prompt the user to connect to Spotify (because you know they are already using Spotify if it is active). The Spotify app will be considered active if music is playing. Returns true if Spotify is active, otherwise false.
no setter

Static Methods

addToLibrary({required String spotifyUri}) Future
Adds the given spotifyUri to the users library
connectToSpotifyRemote({required String clientId, required String redirectUrl, String spotifyUri = '', bool asRadio = false, String? scope, String playerName = 'Spotify SDK', String? accessToken}) Future<bool>
Connects to Spotify Remote, returning a bool for confirmation
disconnect() Future<bool>
Logs the user out and disconnects the app from the users spotify account
getAccessToken({required String clientId, required String redirectUrl, String spotifyUri = '', bool asRadio = false, String? scope}) Future<String>
Returns an access token as a String
getAuthenticationToken({required String clientId, required String redirectUrl, String spotifyUri = '', bool asRadio = false, String? scope}) Future<String>
getCapabilities({required String spotifyUri}) Future<Capabilities?>
Gets the Capabilities of the current user
getCrossFadeState() Future<CrossfadeState?>
Gets the current CrossfadeState
getImage({required ImageUri imageUri, ImageDimension dimension = ImageDimension.medium}) Future<Uint8List?>
Gets an image from a specified imageUri
getLibraryState({required String spotifyUri}) Future<LibraryState?>
Gets the LibraryState of the given spotifyUri
getPlayerState() Future<PlayerState?>
Gets the current PlayerState
pause() Future
Pauses the current playing track
play({required String spotifyUri, bool asRadio = false}) Future
Plays the given spotifyUri
queue({required String spotifyUri}) Future
Queues the given spotifyUri
removeFromLibrary({required String spotifyUri}) Future
Removes the given spotifyUri from the users library
resume() Future
Resumes the current paused track
seekTo({required int positionedMilliseconds}) Future
Seeks the current track to the given positionedMilliseconds
seekToRelativePosition({required int relativeMilliseconds}) Future
Adds the given relativeMilliseconds to the current playback time.
setRepeatMode({required RepeatMode repeatMode}) Future
Sets the repeat mode
setShuffle({required bool shuffle}) Future
Sets the shuffle mode
skipNext() Future
Skips to the next track
skipPrevious() Future
Skips to the previous track
skipToIndex({required String spotifyUri, required int trackIndex}) Future
Skips to track at specified index in album or playlist
subscribeCapabilities() Stream<Capabilities>
Subscribes to the Capabilities of the current user
subscribeConnectionStatus() Stream<ConnectionStatus>
Subscribes to the ConnectionStatus and returns it.
subscribePlayerContext() Stream<PlayerContext>
Subscribes to the PlayerContext and returns it.
subscribePlayerState() Stream<PlayerState>
Subscribes to the PlayerState and returns it.
subscribeUserStatus() Stream<UserStatus>
Subscribes to the UserStatus
toggleRepeat() Future
Toggles repeat
toggleShuffle() Future
Toggles shuffle