tenor 1.0.4
tenor: ^1.0.4 copied to clipboard
Fetch Tenor Gifs on dart client and server + on Flutter.
Tenor #
Donate
#

Fetch, Search GIF more easily and customised manner from Tenor #
Table of Contents #
Lets Get Started #
1. Depend on it #
Add this to your package's pubspec.yaml
file:
dependencies:
tenor:
2. Install it #
You can install packages from the command line:
with pub
:
$ pub get
with Flutter
:
$ flutter packages get
3. Import it #
Now in your Dart
code, you can use:
import 'package:tenor/tenor.dart';
Usage #
Initialize Tenor #
Initialize Tenor library
var api = Tenor(apiKey: 'ApiKey');
Fetch Trending GIF #
Fetch some Trending GiIF
//requestTrendingGIF({int limit = 1, String contentFilter = ContentFilter.off, String mediaFilter = MediaFilter.minimal});
// fetch trending GIF
TenorResponse res = await api.requestTrendingGIF(limit: 5);
res.results.forEach((tenorResult) {
var title = tenorResult.title;
var media = tenorResult.media;
print('$title: gif : ${media?.gif?.previewUrl?.toString()}');
});
Search for GIF #
Search for the GIF
//searchGIF(String search, {int limit = 1, String contentFilter = ContentFilter.off, String mediaFilter = MediaFilter.minimal});
TenorResponse res = await api.searchGIF('subscribe mrbeast', limit: 5);
res.results.forEach((tenorResult) {
var title = tenorResult.title;
var media = tenorResult.media;
print('$title: gif : ${media?.gif?.previewUrl?.toString()}');
});

Fetching Options #
key | description |
---|---|
limit | eg. limit the number of GIF to be fetched. limit can vary from 1 to 50 |
contentFilter | default: low . (values: off , low , medium , high ) specify the content safety filter level. eg. contentFilter: ContentFilter.low |
mediaFilter | default: minimal . (values: basic , minimal ) Reduce the Number of GIF formats returned in response. minimal- (tinygif, gif, and mp4) . basic- (nanomp4, tinygif, tinymp4, gif, mp4, and nanogif) eg. mediaFilter: MediaFilter.minimal |
Fetch Next Set of GIF Response #
fetchNext()
is used to get next set of response for the current query
// fetchNext({int limit = 1});
// here the fetchNext function is used to call next set of GIF for the current response
TenorResponse nextResult = await res.fetchNext();
print('next results');
nextResult.results.forEach((tenorResult) {
var title = tenorResult.title;
var media = tenorResult.media;
print('$title: gif : ${media?.gif?.previewUrl?.toString()}');
});
Fetching Next Options #
key | description |
---|---|
limit | eg. limit the number of GIF to be fetched. limit can vary from 1 to 50 |
Features coming in next version #
On-going implementation for future:
- Some more Functions
- Fetch Categories
- Download GIF