replaceAt method

Playlist replaceAt(
  1. int index,
  2. PlaylistAudioReplacer replacer, {
  3. bool keepPlayingPositionIfCurrent = false,
})

Implementation

Playlist replaceAt(int index, PlaylistAudioReplacer replacer,
    {bool keepPlayingPositionIfCurrent = false}) {
  if (index < audios.length) {
    final oldElement = audios.elementAt(index);
    final newElement = replacer(oldElement);
    audios[index] = newElement;
    super.currentlyOpenedIn.forEach((playerEditor) {
      playerEditor.onAudioReplacedAt(index, keepPlayingPositionIfCurrent);
    });
  }
  return this;
}