quotable_flutter 0.0.1
quotable_flutter: ^0.0.1 copied to clipboard
Wrapper around Quotable, which is a free and open source quotations API.
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.
![Screenshot 2022-06-27 at 19 20 52](https://user-images.githubusercontent.com/47142137/176159935-c2a8b6ba-c607-4bd8-aecd-1fc3ba44c2e1.png)
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