startOrResume method
- @Deprecated("Use `startWithTracks()` or `startWithContext()` to start a new context and resume() instead")
- String? deviceId,
- StartOrResumeOptions? options,
- bool retrievePlaybackState = true,
Start a new context or resume current playback on the user's active device.
deviceId
is optional. If not provided, the user's currently active device
is the target.
options
is optional. If not provided, playback will start
from the context's current track.
retrievePlaybackState
is optional. If true, the current playback state
will be retrieved. Defaults to true.
Implementation
@Deprecated(
"Use `startWithTracks()` or `startWithContext()` to start a new context and resume() instead")
Future<PlaybackState?> startOrResume(
{String? deviceId,
StartOrResumeOptions? options,
bool retrievePlaybackState = true}) async {
final body = options?.toJson();
final json = body != null ? jsonEncode(body) : null;
await _api._put(
'$_path/play?${_buildQuery({'device_id': deviceId})}',
json,
);
return retrievePlaybackState ? playbackState() : null;
}