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

This dart plugin provides access to the Hadith data offline.

pub package

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());
}

Get a single collection:

import 'package:hadith/hadith.dart';

void main() {
  print(getCollection(Collections.bukhari));
}

Get collection data:

import 'package:hadith/hadith.dart';

void main() {
  print(getCollectionData(Collections.bukhari, Languages.en));
}

Books:

Get books of a collection:

import 'package:hadith/hadith.dart';

void main() {
  print(getBooks(Collections.bukhari));
}

Get a single book:

import 'package:hadith/hadith.dart';

void main() {
  print(getBook(Collections.bukhari, 1));
}

Get book data:

import 'package:hadith/hadith.dart';

void main() {
  print(getBookData(Collections.bukhari, 1, Languages.en));
}

Hadiths:

Get hadiths of a book:

import 'package:hadith/hadith.dart';

void main() {
  print(getHadiths(Collections.bukhari, 1));
}

Get a single hadith:

import 'package:hadith/hadith.dart';

void main() {
  print(getHadith(Collections.bukhari, 1, 1));
}

Get hadith data:

import 'package:hadith/hadith.dart';

void main() {
  print(getHadithData(Collections.bukhari, 1, 1, Languages.en));
}

Get hadith data by hadith number:

import 'package:hadith/hadith.dart';

void main() {
  print(getHadithDataByNumber(Collections.bukhari, '1', Languages.en));
}
import 'package:hadith/hadith.dart';

void main() {
  print(getHadithDataByNumber(Collections.muslim, '36 b', Languages.en));
}

URLs:

Get collection URL:

import 'package:hadith/hadith.dart';

void main() {
  print(getCollectionURL(Collections.bukhari));
}

Get book URL:

import 'package:hadith/hadith.dart';

void main() {
  print(getBookURL(Collections.bukhari, 1));
}
7
likes
130
pub points
71%
popularity

Publisher

verified publisheraqeelshamz.com

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