seek method
Seeks to the given position in the user’s currently playing track.
positionMs
is required. The position in milliseconds to seek to.
deviceId
is optional. If not provided, the user's currently active device
is the target.
retrievePlaybackState
is optional. If true, the current playback state
will be retrieved. Defaults to true.
Implementation
Future<PlaybackState?> seek(int positionMs,
{String? deviceId, bool retrievePlaybackState = true}) async {
assert(positionMs >= 0, 'positionMs must be greater or equal to 0');
await _api._put('$_path/seek?${_buildQuery({
'position_ms': positionMs,
'device_id': deviceId
})}');
return retrievePlaybackState ? playbackState() : null;
}