Last updated:
0 purchases
hadith
This dart plugin provides access to the Hadith data offline.
Available Hadith data:
Bukhari
Muslim
Abu Dawud
Tirmidhi
Nasai
Ibn Majah
Hadith data is taken from sunnah.com.
Getting Started #
To use this plugin, add hadith as a dependency in your pubspec.yaml file.
Functions:
Collections:
getCollections() - Returns a list of Hadith collections available
getCollection(Collection collection) - Takes [collection] as an argument and returns a [Collection] object.
getCollectionData(Collections collection, Languages language) - Takes [collection] and [language] as arguments and returns a [CollectionData] object.
Books:_
getBooks(Collections collection) - Takes [collection] as an argument and returns a list of [Book] objects.
getBook(Collections collection, int bookNumber) - Takes [collection] and [bookNumber] as arguments and returns a [Book] object.
getBookData(Collections collection, int bookNumber, Languages language) - Takes [collection], [bookNumber] and [language] as arguments and returns a [BookData] object.
Hadiths:
getHadiths(Collections collection, int bookNumber) - Takes [collection] and [bookNumber] as arguments and returns a list of [Hadith] objects.
getHadith(Collections collection, int bookNumber, int hadithNumber) - Takes [collection], [bookNumber] and [hadithNumber] as arguments and returns a [Hadith] object.
getHadithByNumber(Collections collection, String hadithNumber) - Takes [collection] and [hadithNumber] as arguments and returns a [Hadith] object.
getHadithData(Collections collection, int bookNumber, int hadithNumber, Languages language) - Takes [collection], [bookNumber], [hadithNumber] and [language] as arguments and returns a [HadithData] object.
getHadithDataByNumber(Collections collection, String hadithNumber, Languages language) - Takes [collection], [hadithNumber] and [language] as arguments and returns a [HadithData] object.
URLs:
getCollectionURL(Collections collection) - Takes [collection] as argument and returns the URL (from sunnah.com) of that collection
getBookURL(Collections collection, int bookNumber) - Takes [collection] and [bookNumber] as arguments and returns the URL (from sunnah.com) of that book
Enums:
Collections:
Bukhari - Collections.bukhari
Muslim - Collections.muslim
Abu Dawud - Collections.abudawud
Tirmidhi - Collections.tirmidhi
Nasai - Collections.nasai
Ibn Majah - Collections.ibnmajah
Languages:
English - Languages.en
Arabic - Languages.ar
Example #
Collections:
Get available collections:
import 'package:hadith/hadith.dart';
void main() {
print(getCollections());
}
copied to clipboard
Get a single collection:
import 'package:hadith/hadith.dart';
void main() {
print(getCollection(Collections.bukhari));
}
copied to clipboard
Get collection data:
import 'package:hadith/hadith.dart';
void main() {
print(getCollectionData(Collections.bukhari, Languages.en));
}
copied to clipboard
Books:
Get books of a collection:
import 'package:hadith/hadith.dart';
void main() {
print(getBooks(Collections.bukhari));
}
copied to clipboard
Get a single book:
import 'package:hadith/hadith.dart';
void main() {
print(getBook(Collections.bukhari, 1));
}
copied to clipboard
Get book data:
import 'package:hadith/hadith.dart';
void main() {
print(getBookData(Collections.bukhari, 1, Languages.en));
}
copied to clipboard
Hadiths:
Get hadiths of a book:
import 'package:hadith/hadith.dart';
void main() {
print(getHadiths(Collections.bukhari, 1));
}
copied to clipboard
Get a single hadith:
import 'package:hadith/hadith.dart';
void main() {
print(getHadith(Collections.bukhari, 1, 1));
}
copied to clipboard
Get hadith data:
import 'package:hadith/hadith.dart';
void main() {
print(getHadithData(Collections.bukhari, 1, 1, Languages.en));
}
copied to clipboard
Get hadith data by hadith number:
import 'package:hadith/hadith.dart';
void main() {
print(getHadithDataByNumber(Collections.bukhari, '1', Languages.en));
}
copied to clipboard
import 'package:hadith/hadith.dart';
void main() {
print(getHadithDataByNumber(Collections.muslim, '36 b', Languages.en));
}
copied to clipboard
URLs:
Get collection URL:
import 'package:hadith/hadith.dart';
void main() {
print(getCollectionURL(Collections.bukhari));
}
copied to clipboard
Get book URL:
import 'package:hadith/hadith.dart';
void main() {
print(getBookURL(Collections.bukhari, 1));
}
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.