setReciter method

Future<void> setReciter(
  1. int index
)

Change the reciter.

Implementation

Future<void> setReciter(int index) async {
  if (index < 0 || index >= reciters.length) return;
  _reciterIndex = index;
  await storage.setInt('quran_audio_reciter', index);
  state.value = state.value.copyWith(reciterIndex: index);

  if (state.value.isActive) {
    playAyah(state.value.surah, state.value.ayah);
  }
}