0 purchases
quotable flutter
This package (unofficial) uses a free and opensource quotation API called Quotable.
Features #
Get a random quote, list of quotes or search them as query by quotes and authors. You can also use tags to filter quotes and sort or order them as per the parameters.
Getting started #
Quote Model
Quote({
String id,
String content,
String author,
int length,
List<String> tags,
});
copied to clipboard
Author Model
Author({
String id,
String bio,
String description,
String link,
String name,
String slug,
int quoteCount,
});
copied to clipboard
Get Quotes from Quotable Repository
Future<Quote> Quotable.getRandom({
List<String>? tags,
int? maxLength,
int? minLength,
});
Future<List<Quote>> Quotable.getListQuotes({
List<String>? tags,
List<String>? authors,
SortBy sortBy = SortBy.dateAdded,
Order order = Order.desc,
int page = 1,
int limit = 20,
})
Future<List<Quote>> Quotable.searchQuotes({
required String query,
int page = 1,
int limit = 20,
})
Future<List<Author>> Quotable.searchAuthor({
required String query,
int page = 1,
int limit = 20,
})
copied to clipboard
If you are confused about page and limit or how they work together then read this table.
Usage #
// get random - Quote()
void main() async {
Quote quoteRamdon = await Quotable.getRandom();
List<Quote> listQuotes = await Quotable.getListQuotes(limit: 5);
List<Quote> queryQuote = await Quotable.searchQuotes(query: 'wisdom', limit: 5);
List<Author> queryAuthor = await Quotable.searchAuthor(query: 'einstein');
}
copied to clipboard
Additional information #
If you find any issues or want to contribute then please feel free to open an issues or a discussion here
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.