moveTrackInPlaylist method

  1. @override
Future<void> moveTrackInPlaylist(
  1. int fromIndex,
  2. int toIndex
)
override

Moves a track within the playlist from one index to another.

Throws PlaylistException if operation fails.

Implementation

@override
Future<void> moveTrackInPlaylist(int fromIndex, int toIndex) async {
  final Playlist? playlist = _currentPlaylist;
  final PlaylistService? playlistService = _playlistService;
  if (playlist != null && playlistService != null) {
    final Playlist updatedPlaylist = await playlistService
        .reorderPlaylistTracks(playlist.id, fromIndex, toIndex);
    await loadPlaylist(updatedPlaylist);
  }
}