tmdb_api

Creator: coderz1093

Last updated:

Add to Cart

Description:

tmdb api

tmdb_api #








A TheMovieDatabase client library for dart.
To know more about TMDB visit offical site
Getting started #


Adding as dependencies
Pub.dev's installation guide
Add this to your package's pubspec.yaml file:
dependencies:
tmdb_api: latest //visit tmdb for latest version number
copied to clipboard


Import it
Now in your Dart code, you can use:
import 'package:tmdb_api/tmdb_api.dart';
copied to clipboard


Create Instance
Now you need to create instance for TMDB and ApiKeys with your api keys.
final tmdbWithCustomLogs = TMDB( //TMDB instance
ApiKeys('Your API KEY', 'apiReadAccessTokenv4'),//ApiKeys instance with your keys,
);
copied to clipboard


Configuring console logs
There are 3 logconfigs presets avaliable.

ConfigLogger.showAll(): development use.
ConfigLogger.showRecommended(): development use.
ConfigLogger.showNone(): production use.

You can add any off this presets to logConfig named parameter of TMDB instance
Custom Logs
final tmdbWithCustomLogs = TMDB(
ApiKeys('Your API KEY', 'apiReadAccessTokenv4'),
logConfig: ConfigLogger(
showLogs: true,//must be true than only all other logs will be shown
showErrorLogs: true,
),
);
copied to clipboard


Example #
For getting Trending movies
Map result = await tmdb.v3.trending.getTrending(mediaType = MediaType.all,timeWindow = TimeWindow.day);
copied to clipboard
Custom Dio instance #
final tmdbWithCustomLogs = TMDB(
ApiKeys('Your API KEY', 'apiReadAccessTokenv4'),
dio:Dio()// your own dio instance
);
copied to clipboard
Setting Default api data language #
final tmdbWithCustomLogs = TMDB(
ApiKeys('Your API KEY', 'apiReadAccessTokenv4'),
defaultLanguage:'en-US'// sets default language for all supported endpoints
);
copied to clipboard
Adding Interceptors #
final tmdbWithCustomLogs = TMDB(
ApiKeys('Your API KEY', 'apiReadAccessTokenv4'),
interceptors:Interceptors()..add(/*your interceptor*/)
);
copied to clipboard
or
final customDio = Dio();
customDio.interceptors.add(/*your interceptor*/)

final tmdbWithCustomLogs = TMDB(
ApiKeys('Your API KEY', 'apiReadAccessTokenv4'),
dio:dio
);
copied to clipboard
note:Use interceptors only when you are not using a custom Dio instance.
For more API documentation #
visit offical API documentation

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.