getAdhkar static method

dynamic getAdhkar({
  1. String adhkarId = "",
})

Implementation

static dynamic getAdhkar({String adhkarId = ""}) {
  try {
    if (adhkarId.isNotEmpty) {
      Adhkar response =
          adhkarData.firstWhere((adhkar) => adhkar.id == adhkarId);
      return response;
    } else {
      List<Adhkar> adhkars = [];
      for (var i = 0; i < adhkarData.length; i++) {
        adhkars.add(adhkarData[i]);
      }
      return adhkars;
    }
  } catch (error) {
    throw Exception(error.toString());
  }
}