twitch 0.3.2

twitch #

Unofficial Twitch API for Dart and Flutter.

pub package Build Status Coverage Status

NOTE: This is not an official Google or Dart project.

Installation #

Simply add twitch to your pubspec.yaml file:

  twitch: ^0.3.0

You'll need a Twitch API token (called a "client ID") for this to be useful. Visit the twitch developer site to signup - it just takes a minute or two.

WARNING: The default implementation only works in the command-line VM and Flutter, and may not be loaded in the browser at all in Dart versions older than 1.23.0. Starting at 1.23.0 it's trivial to implement a browser version of TwitchHttp, but this has not been yet. Consider contributing!

Usage #

This API is incomplete, and currently supports a high-level Twitch class (with a strongly-typed idiomatic Dart API) and a lower-level TwitchHttp class that allows making any call to the Twitch API server, provided you know the URL endpoints (see the API documentation).

For example, how to get the top played games on Twitch:

import 'dart:async';

import 'package:twitch/twitch.dart';

/// With a pre-authorized client ID, prints the top games on Twitch.
/// Assumes the environment variable `TWITCH_CLIENT_ID` to be set.
main() async {
  var http = new TwitchHttp.fromEnv();
  var twitch = new Twitch(http); 
  // Calls and decodes GET
  final result = await twitch.getTopGames();
  print('The top game on Twitch is currently: ${}');

Contributing #

We welcome a diverse set of contributions, including, but not limited to:

For the stability of the API and existing users, consider opening an issue first before implementing a large new feature or breaking an API. For smaller changes (like documentation, bug fixes), just send a pull request.

0.3.2 #

  • Added Twitch#searchChannels|searchGames|getChannelVideos.
  • Also significant API additions to Channel.

Special thanks to @brianegan for this release!

0.3.1 #

Added Twitch#getTopVideos, returning videos sorted by current viewers:

abstract class Video {
 String get id;
 String get description;
 Channel get channel;
 String get game;
 String get title;
 String get url;
 TwitchCdnImage get preview;

Special thanks to @brianegan for this release!

0.3.0 #

This should be the minimum amount of features implemented to easily create some UI for AngularDart or Flutter. If you like this package and want to see it grow, consider filing feature requests or even better, contributing.

  • Added TopGame; see games.
  • Added a TwitchCdnImage, wrapper around Twitch's URL locations for an image.
  • Added a Response<T>, which is an Iterable<T> with a int total field.
  • Experimental Twitch#getTopGames stable, returns Future<Response<TopGame>:
abstract class TopGame {
  int get channels;
  int get viewers;
  int get popularity;
  int get id;
  String get name;

  TwitchCdnImage get box;
  TwitchCdnImage get logo;

0.2.0 #

  • Remove the json (decoder) property from the TwitchHttp client.
  • Added an authorized factory to TwitchHttp:
  • Additionally, all of the parameters to TwitchHttp are now named parameters:
new TwitchHttp(
  clientID: '...',

new TwitchHttp.authorized(
  accessToken: '...',
  clientID: '...',
  • Added a Twitch class for a high-level set of APIs on top of TwitchHttp:
final result = await twitch.getTopGames();

0.1.0+1 #

  • A few fixes in documentation and the README.

0.1.0 #

  • Initial commit.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  twitch: ^0.3.2

2. Install it

You can install packages from the command line:

with pub:

$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:twitch/twitch.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see

Maintenance issues and suggestions

Make sure dartdoc successfully runs on your package's source files. (-10 points)

Dependencies were not resolved.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.22.0 <2.0.0