toggleSource method

Future<void> toggleSource(
  1. String source
)

Toggles play/pause for source. Calling on a non-active source switches to it and starts playing.

Implementation

Future<void> toggleSource(String source) async {
  if (isPlayingSource(source)) {
    await pauseSource(source);
  } else {
    await playSource(source);
  }
}