cycleLoop method

Future<bool> cycleLoop([
  1. String? player
])

Cycle through loop modes: None → Track → Playlist → None

Implementation

Future<bool> cycleLoop([String? player]) async {
  final current = await getLoop(player);
  if (current == null) return false;

  final currentTrimmed = current.trim();
  String newStatus;
  if (currentTrimmed == 'None') {
    newStatus = 'Track';
  } else if (currentTrimmed == 'Track') {
    newStatus = 'Playlist';
  } else {
    newStatus = 'None';
  }

  return setLoop(newStatus, player);
}