搜尋套件、儲存庫與 APP 分類

套件詳情v0.7.0

twitch_api

一個純 Dart 編寫的包裝器,用於透過 OAuth 隱式認證連接到 Twitch.tv。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
51
喜歡數
21
Pub 分數
150

安裝套件

flutter pub add twitch_api

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

一個純 Dart 套件,提供用於透過 OAuth 隱式驗證連接到 Twitch.tv API 的包裝器。它簡化了與 Twitch 服務的整合,讓開發者能夠驗證使用者並存取公開資料,例如串流、頻道和使用者資訊。該套件支援多種平台,包括 Android、iOS、Web、macOS、Windows 和 Linux,非常適合跨平台應用程式。設計上強調易用性,處理 OAuth 流程的複雜性,同時維持安全性,並與 Twitch 目前的驗證標準相容。

適用情境

  • 整合 Twitch 登錄功能
  • 獲取即時串流資料
  • 訪問使用者和頻道資訊
  • 構建基於 Twitch 的社交應用
  • 為主播建立儀表板

主要特色

  • OAuth 隱式認證
  • 跨平台支援
  • 純 Dart 實現
  • 簡單 API 接口
  • 安全的令牌處理

適合對象

  • 需要 Twitch 集成的 Flutter 應用
  • 流監控工具
  • Twitch 社區平台
  • Twitch內容開發工具
  • 跨平台應用程式

使用建議

  • 需要正確的 Twitch 應用註冊
  • 僅限 OAuth 隱式流程
  • 取決於 Twitch API 的速率限制
  • 需要仔細處理刷新令牌
  • 不適用於伺服器端作業

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

twitch_api

Dart Pub Coverage Status style: lint

A wrapper in pure Dart to connect to Twitch.tv using OAuth implicit authentication.

All the endpoints are implemented as defined in the Twitch API Reference

Getting started

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 webview
Future<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);

  return Navigator.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)
Bits
  • [x] Get Bits Leaderboard
  • [x] Get Cheermotes
  • [x] Get Extension Transactions
Channels
  • [x] Get Channel Information
  • [x] Modify Channel Information
  • [x] Get Channel Editors
Channel Points
  • [x] Create Custom Rewards
  • [x] Delete Custom Reward
  • [x] Get Custom Reward
  • [x] Get Custom Reward Redemption
  • [x] Update Custom Reward
  • [x] Update Redemption Status
Chat
  • [x] Get Channel Emotes
  • [x] Get Global Emotes
  • [x] Get Emote Sets
  • [x] Get Channel Chat Badges
  • [x] Get Global Chat Badges
  • [x] Get Chat Settings
  • [ ] Update Chat Settings
Clips
  • [x] Create Clip
  • [x] Get Clips
Entitlements
  • [ ] Create Entitlement Grants Upload URL
  • [ ] Get Code Status
  • [ ] Get Drops Entitlements
  • [ ] Redeem Code
Extensions
  • [ ] Get Extension Configuration Segment
  • [ ] Set Extension Configuration Segment
  • [ ] Set Extension Required Configuration
  • [ ] Send Extension PubSub Message
  • [ ] Get Live Channels
  • [ ] Get Extension Secrets
  • [ ] Create Extension Secret
  • [ ] Send Extension Chat Message
  • [ ] Get Extensions
  • [ ] Get Released Extensions
  • [ ] Get Extension Bits Products
  • [ ] Update Extension Bits Product
EventSub
  • [ ] Create EventSub Subscription
  • [ ] Delete EventSub Subscription
  • [ ] Get EventSub Subscriptions
Games
  • [x] Get Top Games
  • [x] Get Games
Hype Train
  • [ ] Get Hype Train Events
Moderation
  • [ ] Check AutoMod Status
  • [ ] Get Banned Events
  • [ ] Get Banned Users
  • [ ] Get Moderators
  • [ ] Get Moderator Events
Polls
  • [ ] Get Polls
  • [ ] Create Poll
  • [ ] End Poll
Predictions
  • [ ] Get Predictions
  • [ ] Create Prediction
  • [ ] End Prediction
Schedule
  • [ ] Get Channel Stream Schedule
  • [ ] Get Channel iCalendar
  • [ ] Update Channel Stream Schedule
  • [ ] Create Channel Stream Schedule Segment
  • [ ] Update Channel Stream Schedule Segment
  • [ ] Delete Channel Stream Schedule Segment
Search
  • [x] Search Categories
  • [x] Search Channels
Streams
  • [ ] Get Stream Key
  • [x] Get Streams
  • [ ] Create Stream Marker
  • [ ] Get Stream Markers
Subscriptions
  • [x] Get Broadcaster Subscriptions
Tags
  • [ ] Get All Stream Tags
  • [ ] Get Stream Tags
  • [ ] Replace Stream Tags
Users
  • [x] Get Users
  • [ ] Update User
  • [x] Get Users Follows
  • [ ] Create User Follows
  • [ ] Delete User Follows
  • [ ] Get User Block List
  • [ ] Block User
  • [ ] Unblock User
  • [ ] Get User Extensions
  • [ ] Get User Active Extensions
  • [ ] Update User Extensions
Videos
  • [ ] Get Videos
  • [ ] Delete Videos
Webhooks
  • [ ] Get Webhook Subscriptions

Contributors

TesteurManiak
Guillaume Roux
matteo0158
LaCremeDoree
LewisHolliday
Lewis Holliday

所屬分類

依賴

依賴清單 3 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。