seek method

Future<PlaybackState?> seek(
  1. int positionMs, {
  2. String? deviceId,
  3. bool retrievePlaybackState = true,
})

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;
}