getSurahByMultiEdition function

Future<List<Surah>> getSurahByMultiEdition(
  1. List<String> editions
)

Returns the requested surah from multiple editions

Implementation

Future<List<Surah>> getSurahByMultiEdition(List<String> editions) async {
  assert(editions.isEmpty, '[error][getSurahByEdition()] editions list can not be empty');
  final buffer = StringBuffer(editions.first);
  for (var i = 1; i < editions.length; i++) {
    buffer.write(',${editions[i]}');
  }
  final res = await get('/surah/${buffer.toString()}');
  return (res['data'] as List).map<Surah>((e) => Surah.fromMap(e as Map<String, dynamic>)).toList();
}