fetchRecitationsList method

Future<List<Recitation>?> fetchRecitationsList()

Implementation

Future<List<Recitation>?> fetchRecitationsList() async {
  List<Recitation>? recitationsList = await _recitationLocalDataSource.fetchRecitationsList();
  if ((recitationsList != null && recitationsList.isNotEmpty)) {
    return recitationsList;
  } else {
    final MyResponse<Recitation> response = await _recitationApi.fetchRecitationsList();
    if (response.code == Apis.CODE_SUCCESS) {
      recitationsList = response.data as List<Recitation>;
      _recitationLocalDataSource.saveRecitationsList(recitationsList);
    }
    return recitationsList;
  }
}