startWithContext method

Future<PlaybackState?> startWithContext(
  1. String contextUri, {
  2. String? deviceId,
  3. Offset? offset,
  4. bool retrievePlaybackState = true,
})

Start a new playback context (album, playlist) with given a contextUri. and given optional deviceId. If not provided, the user's currently active device is the target. Set Offset to start playback at a specific point. retrievePlaybackState is optional. If true, the current PlaybackState will be retrieved. Default's to true.

Note: Before starting a new playback context check the playbackState if necessary before resumeing, otherwise you overwrite the current context.

Implementation

Future<PlaybackState?> startWithContext(String contextUri,
    {String? deviceId,
    Offset? offset,
    bool retrievePlaybackState = true}) async {
  assert(
      contextUri.isNotEmpty, 'Cannot start playback with empty context uri');
  var options =
      StartWithContextOptions(contextUri: contextUri, offset: offset);
  return startOrResume(
      deviceId: deviceId,
      options: options,
      retrievePlaybackState: retrievePlaybackState);
}