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

套件詳情v0.5.2

flutter_stetho

適用於 Android 上 Flutter 的 Chrome DevTools 網路檢查器

近 30 天下載
607
喜歡數
42
Pub 分數
35

安裝套件

flutter pub add flutter_stetho

套件介紹

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

flutter_stetho 是一個調試工具,可將 Chrome DevTools 與 Android 上的 Flutter 整合,讓開發者能夠即時檢視網路請求與回應。它利用 Facebook 的 Stetho 庫,提供對 HTTP 流量的詳細洞察,包括標頭、載荷和時間資訊。此套件透過提供熟悉介面來診斷網路相關問題,從而提升開發工作流程,且除了新增相依性外,無需額外設定。在應用程式開發與測試階段特別實用。

適用情境

  • 檢查 HTTP 請求和回應
  • 除錯 API 結合
  • 監控網絡性能
  • 排查連接問題
  • 即時網路日誌

主要特色

  • Chrome DevTools 結合
  • 網路請求檢查
  • 即時交通監控
  • 透過 pub add 進行簡單設定
  • 僅限 Android 支援

適合對象

  • Flutter 開發人員調試網路呼叫
  • 使用 Chrome DevTools 工作流程的團隊
  • 專注於API行為的移動應用測試人員

使用建議

  • 僅限 Android 平台
  • 不適用於生產建構
  • 需要 Chrome DevTools
  • 可能影響調試模式下的效能
  • 無 iOS 支援

原始 README

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

flutter_stetho

A plugin that connects Flutter to the Chrome Dev Tools on Android devices via the Stetho Android Library.

Network Inspector

The main feature I was aiming to achieve was a Network Inspector.

Network Inspector in Action

Getting Started

How can you too get this plugin up and running in your own app? Follow these steps.

Install the plugin

Add flutter_stetho to your dependencies in the pubspec.yaml file

  • For Flutter 1.7.x, use version 0.3.x
  • For Flutter 1.8.x, use version 0.4.x
  • For Flutter 1.9.x, use version 0.5.x
Install StethoHttpOverrides

Next, you'll need to install the Stetho.initialize() in the main() function of your app. This will enable Stetho and allow flutter_stetho to wrap all http calls and report information to the Chrome Dev Tools via the Stetho package from Facebook.

Note: It's probably a good idea only put this override in a main_dev.dart file.

void main() {
  Stetho.initialize();

  runApp(new MyApp());
}
Run your app on an Android Device

flutter run

Open Chrome

Pop open Chrome or Chromium, navigate to chrome://inspect

You should now see your App appear in the window.

Known Issues

  • Timing may be slightly off for some requests. That's because:
  • Code is rough mvp / prototype code. Needs improvement.
  • Animated Gifs not working
  • Some error cases may not be properly handled. Need more testing / feedback to find problems.
  • No Tests
  • If the app shuts down on start up run flutter clean to remove old builds.

所屬分類

原始碼儲存庫

使用此套件的專案