previous method

void previous()

Implementation

void previous() async {
  if (currentPosition.inSeconds.toInt() - 2 > 0) {
    seek(0);
  } else if (index! > 0) {
    stopAndReleaseAudioPlayer();
    _index = index! - 1;
    nextAlbumCover = currentAlbumCover;
    currentAlbumCover = await extractAlbumCover(audioTrack);
    if (index! > 0) {
      previousAlbumCover = await extractAlbumCover(playlist[index! - 1]);
    }
    isPlaying = false;
    play();
  } else {
    seek(0);
  }
  extractDominantColor();
  notifyListeners();
}