Skip to content

Instantly share code, notes, and snippets.

@mhmzdev
Created June 25, 2020 02:32
Show Gist options
  • Save mhmzdev/8b4885334dc012bdfc2d83e5fe4d59ad to your computer and use it in GitHub Desktop.
Save mhmzdev/8b4885334dc012bdfc2d83e5fe4d59ad to your computer and use it in GitHub Desktop.
class QuranAPI {
Future<SurahsList> getSurahList() async {
String url = "http://api.alquran.cloud/v1/quran/quran-uthmani";
final response = await http.get(url);
if (response.statusCode == 200) {
return SurahsList.fromJSON(json.decode(response.body));
} else {
print("Failed to load");
throw Exception("Failed to Load Post");
}
}
Future<SajdaList> getSajda() async {
String url = "http://api.alquran.cloud/v1/sajda/quran-uthmani";
final response = await http.get(url);
if (response.statusCode == 200) {
return SajdaList.fromJSON(json.decode(response.body));
} else {
print("Failed to load");
throw Exception("Failed to Load Post");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment