Player extension

on

Methods

addToQueue(String uriToAdd, {String? deviceId}) Future<void>

Available on SpotifyApi, provided by the Player extension

Adds the item with the given uriToAdd to the end of the user's playback queue.
getAvailableDevices() Future<List<Device>>

Available on SpotifyApi, provided by the Player extension

Retrieves a list of available devices where playback can be controlled.
getCurrentlyPlayingTrack() Future<Track?>

Available on SpotifyApi, provided by the Player extension

Gets the track currently playing on the user's active device. Returns null if nothing is playing or no device is active.
getPlaybackState() Future<PlaybackState?>

Available on SpotifyApi, provided by the Player extension

Returns the current playback state of the user (device, progress, repeat mode, etc.) Returns null if nothing is currently playing or no active device.
getQueue() Future<List<Track>>

Available on SpotifyApi, provided by the Player extension

Returns a list of tracks currently in the user's playback queue. The first track is the currently playing track (if present).
getRecentlyPlayed({int? limit, String? after, String? before}) Future<List<Track>>

Available on SpotifyApi, provided by the Player extension

Returns the user's recently played tracks. You can specify limit, after (timestamp in ms), or before to paginate.
refreshPlaybackState() Future<void>

Available on SpotifyApi, provided by the Player extension

Refreshes the current playback state of the user.
seekToPosition(Duration position, {String? deviceId}) Future<void>

Available on SpotifyApi, provided by the Player extension

Seeks to the given position in the currently playing track.
setRepeatMode(String state, {String? deviceId}) Future<void>

Available on SpotifyApi, provided by the Player extension

Sets the repeat mode for playback. Valid state values are 'track', 'context', or 'off'.
setShuffle(bool shuffle, {String? deviceId}) Future<void>

Available on SpotifyApi, provided by the Player extension

Enables or disables shuffle mode for playback.
setVolume(int volumePercent, {String? deviceId}) Future<void>

Available on SpotifyApi, provided by the Player extension

Sets the playback volume to volumePercent, which must be between 0 and 100.
skipToNext({String? deviceId}) Future<void>

Available on SpotifyApi, provided by the Player extension

Skips to the next track in the user's queue.
skipToPrevious({String? deviceId}) Future<void>

Available on SpotifyApi, provided by the Player extension

Skips to the previous track in the user's queue.
startOrResumePlayback({String? deviceId}) Future<void>

Available on SpotifyApi, provided by the Player extension

Starts or resumes playback on the user's active device. Optionally targets a specific deviceId.
togglePlayback() Future<void>

Available on SpotifyApi, provided by the Player extension

Toggles playback: pauses if playing, resumes if paused. Does nothing if there's no active device or no track is currently playing.
transferPlayback(String deviceId, {bool play = true}) Future<void>

Available on SpotifyApi, provided by the Player extension

Transfers playback to a specific device. If play is true, playback will start on the new device.