moveToIndex method

bool moveToIndex(
  1. int index
)

Moves to a specific index in the playlist

Returns true if successful, false if the index is out of bounds

Implementation

bool moveToIndex(int index) {
  if (_sources.isEmpty || index < 0 || index >= _sources.length) {
    return false;
  }

  if (_currentIndex == index) {
    return true;
  }

  _currentIndex = index;
  _notifyIndexChanged();
  return true;
}