Aus öffentlichen Paketdaten erstellte Orientierung.
Ein reiner Dart-Paket, das einen Wrapper für die Verbindung zur Twitch.tv-API über OAuth-Implizit-Authentifizierung bereitstellt. Es vereinfacht die Integration mit Twitch-Diensten und ermöglicht Entwicklern die Authentifizierung von Benutzern sowie den Zugriff auf öffentliche Daten wie Streams, Kanäle und Benutzerinformationen. Das Paket unterstützt mehrere Plattformen, darunter Android, iOS, Web, macOS, Windows und Linux, was es ideal für plattformübergreifende Anwendungen macht. Durch seine benutzerfreundliche Gestaltung übernimmt es die Komplexität der OAuth-Flows, während Sicherheit und Kompatibilität mit den aktuellen Authentifizierungsstandards von Twitch gewahrt bleiben.
Anwendungsfälle
Integration von Twitch-Anmeldefunktion
Live-Stream-Daten werden abgerufen
Zugriff auf Benutzer- und Kanalinformationen
Soziale Apps auf Basis von Twitch erstellen
Dashboards für Streamer erstellen
Hauptmerkmale
OAuth-Implizite Authentifizierung
Plattformübergreifende Unterstützung
Reine Dart-Implementierung
Einfache API-Schnittstelle
Sichere Token-Verwaltung
Geeignet für
Flutter-Apps, die eine Twitch-Integration benötigen
Stream-Monitoring-Tools
Twitch-Community-Plattformen
Entwicklerwerkzeuge für Twitch-Inhalte
Multiplattform-Anwendungen
Hinweise
Erforderliche korrekte Twitch-App-Registrierung
Beschränkt auf OAuth-Implizit-Flow
Abhängig von den Rate-Limits der Twitch-API
Bedarf sorgfältiger Behandlung von Refresh-Token
Nicht geeignet für serverseitige Operationen
Original-README
Originaler README-Schnappschuss aus dem verknüpften Quell-Repository. Aktuelle Inhalte finden Sie im Repository.
twitch_api
A wrapper in pure Dart to connect to Twitch.tv using OAuth implicit authentication.
NOTE: This package is in its early stage, please be patient until more methods are implemented or do not hesitate to open a merge request if you added support for an endpoint. Currently I do not have a roadmap of the endpoint I am going to add in priority so do not hesitate to open an issue to make suggestions depending of your needs.
To use this package you will need to register an application on the Twitch developer console to get a client ID.
After registering your application you will need to instantiate the TwitchClient class from the package with your clientId and your redirectUri .
import'package:twitch_api/twitch_api.dart';
final _twitchClient = TwitchClient(
clientId: clientId,
redirectUri: redirectUri,
);
Now that you have initialized the client the last step before using the method will be to manage the first connection with your twitch account and initialize the token you will receive. You can find a complete example of an implementation using the package flutter_webview_plugin.
const clientId = "<YOUR_CLIENT_ID>";
const redirectUri = "<YOUR_REDIRECT_URL>"; // ex: "http://localhost/"final _twitchClient = TwitchClient(
clientId: clientId,
redirectUri: redirectUri,
);
final _flutterWebviewPlugin = FlutterWebviewPlugin();
// First authentication through a webviewFuture<TwitchToken> _openConnectionPage({
List<TwitchApiScope> scopes = const [],
}) {
// Listen for url changes to detect redirection on our redirectUri.
_flutterWebviewPlugin.onUrlChanged.listen((url) {
if (url.startsWith(_twitchClient.redirectUri)) {
// After you got to your redirectUri you can initialize the token.
_twitchClient.initializeToken(TwitchToken.fromUrl(url));
// Close the webview
_flutterWebviewPlugin.close();
}
});
// When the webview is closed pop the current route.
_flutterWebviewPlugin.onDestroy.listen((_) => Navigator.pop(context));
// Get authorization URL for the connection with the webview.final _url = _twitchClient.authorizeUri(scopes);
returnNavigator.push(
context,
MaterialPageRoute(
builder: (context) => WebViewPage(_url.toString()),
),
).then((_) => _twitchClient.twitchHttpClient.validateToken());
}
Now you are ready to use the methods implemented in Supported Endpoints section.
Supported Endpoints
Ads
[x] Start Commercial
Analytics
[x] Get Extension Analytics
[x] Get Game Analytics (Documentation in progress)