hadith 1.0.1 copy "hadith: ^1.0.1" to clipboard
hadith: ^1.0.1 copied to clipboard

This dart plugin provides access to the Hadith data offline.

example/hadith_example.dart

import 'package:hadith/hadith.dart';

void main() {
  HadithService hadithService = HadithService();

  List<Collection> collections = await hadithService.getCollections();
  print('Available Collections:' + collections.toString());

  List<Book> books = await hadithService.getBooks(Collection.bukhari);
  print('Books for Sahih Bukhari:');
  for (var book in books) {
    print("${books.indexOf(book) + 1}. " + book.book[0].name);
  }

  Book book = await hadithService.getBook(Collection.bukhari, 1);
  print(book);

  List<Hadith> hadiths = await hadithService.getHadiths(Collection.bukhari, 1);
  print('Hadiths for Sahih Bukhari, Book 1: ${hadiths.length}');

  Hadith? hadith = await hadithService.getHadith(Collection.bukhari, 1, 1);
  if (hadith != null) {
    print('Hadith 1: ${hadith.hadith}');
  } else {
    print('Hadith not found');
  }

  String collectionURL = hadithService.getCollectionURL(Collection.bukhari);
  print('Collection URL: $collectionURL');

  String hadithURL = hadithService.getHadithURL(Collection.bukhari, 1, 1);
  print('Hadith URL: $hadithURL');

  String bookURL = hadithService.getBookURL(Collection.bukhari, 1);
  print('Book URL: $bookURL');
}
21
likes
150
points
79
downloads

Publisher

verified publisheraqeelshamz.com

Weekly Downloads

This dart plugin provides access to the Hadith data offline.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

More

Packages that depend on hadith