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

chucker_flutter 封面
套件詳情v1.9.2

chucker_flutter

Chucker Flutter 幫您檢查 HTTP(S) 請求/回應。它會將資料本地儲存,並提供一個 UI 來檢查網路呼叫並分享其內容。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
2.3萬
喜歡數
198
Pub 分數
130

安裝套件

flutter pub add chucker_flutter

套件介紹

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

Chucker Flutter 是一個網路除錯工具,可直接在您的應用中捕獲並顯示 HTTP(S) 請求與回應。它將資料本地儲存,並提供直覺式的使用者介面來檢視呼叫細節、標頭、內容與元資料。非常適合開發與測試,能快速排除 API 互動問題,並支援分享捕獲的資料以促進協作。可在多個平台使用,並能順暢整合至 Flutter 應用中。

適用情境

  • 開發過程中調試 API 呼叫
  • 檢查請求/回應標頭和正文
  • 與團隊成員共享網路資料
  • 在不同條件下測試網路行為
  • 監控 HTTP 請求的效能

主要特色

  • 本地儲存網路呼叫
  • 互動式檢查UI
  • 支援所有主要平台
  • 輕鬆分享捕獲的資料
  • Minimal setup with pub add
  • HTTP(S) 流量的即時監控

適合對象

  • 正在積極開發的Flutter開發者
  • 團隊協作進行API整合
  • 需要詳細網絡日誌的應用程式
  • 前端工程師調試後端問題
  • QA測試人員驗證API行為

使用建議

  • 不適用於生產使用
  • 可能影響效能於除錯模式
  • 在發布版本中需要手動啟用
  • 設備上可能有儲存限制
  • UI 僅在除錯版本中可見

原始 README

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

Stand With Palestine

Chucker Flutter

Codecov Badge Pub.dev Badge Popularity GitHub Build Badge MIT License Badge Flutter Platform Badge Stars Developed By Badge

Chucker Flutter

StandWithPalestine

An HTTP requests inspector inspired by Chucker Android

Chucker Flutter inspects the HTTP(S) requests/responses triggered by your Flutter App. It works as an Interceptor and stores data related to network requests and responses on local storage, and providing a UI for inspecting and sharing their content.

Flutter Apps, using Chucker Flutter, show in-app notifications which tell the status (e.g. 200, 400, 500 and so) and requested url and upon clicking on details button it navigates to Chucker Flutter main screen. You can manipulate Chucker Flutter behaviour using its setting by navigating to Settings page from the menu button of Chucker Flutter main page.

chucker http sample

Getting Started

To use Chucker Flutter you need to add the pub spec dependency to your pubspec.yaml file of your flutter app.

Please verify the current latest version of Chucker Flutter so that you can enjoy the latest features.

dependencies:
  chucker_flutter: latest-version

or

just run the command

flutter pub add chucker_flutter

To make Chucker Flutter work in Dio, just add it in your Dio object e.g.:

Dio().interceptors.add(ChuckerDioInterceptor());

To make Chucker Flutter work in Http, you need to use ChuckerHttpClient object e.g.:

final _chuckerHttpClient = ChuckerHttpClient(http.Client());
_chuckerHttpClient.get(Uri.parse('$_baseUrl$path'));

To make Chucker Flutter work in Chopper, you need to use ChuckerChopperInterceptor object e.g.:

final client = ChopperClient(
        baseUrl: 'https://jsonplaceholder.typicode.com',
        interceptors: [
          ChuckerChopperInterceptor(),
        ]
);

The very last thing is to connect Chucker Flutter screens to your app by wiring ChuckerFlutter.navigatorKey into whichever widget owns your root Navigator.

MaterialApp (most apps)

MaterialApp(
  navigatorKey: ChuckerFlutter.navigatorKey,
  ...,
);

MaterialApp.router with GoRouter

MaterialApp.router does not accept a navigatorKey — pass it to GoRouter instead:

final _router = GoRouter(
  navigatorKey: ChuckerFlutter.navigatorKey,
  routes: [...],
);

MaterialApp.router(
  routerConfig: _router,
  ...,
);

MaterialApp.router with a custom RouterDelegate

Pass ChuckerFlutter.navigatorKey to your delegate's constructor and use it as the key on its root Navigator:

class AppRouterDelegate extends RouterDelegate<...> {
  AppRouterDelegate() : navigatorKey = ChuckerFlutter.navigatorKey;

  @override
  final GlobalKey<NavigatorState> navigatorKey;

  @override
  Widget build(BuildContext context) {
    return Navigator(
      key: navigatorKey,
      pages: [...],
      onDidRemovePage: ...,
    );
  }
}

The previous navigatorObservers: [ChuckerFlutter.navigatorObserver] integration is deprecated and unreliable with nested navigators — it still works as a fallback so existing apps keep running, but new integrations should use navigatorKey.

By default Chucker Flutter only runs in debug mode but you can allow it to run in release mode too using its showOnRelease property e.g.:

void main() {
  ChuckerFlutter.showOnRelease = true;
  runApp(const App());
}

Congratulations! 🎊 You are done. Rest on us!

Features

  • Support for Dio and Http
  • Works in all (Windows💻, Linux🖥️, Mac🧑‍💻, Web🌍, Android📱, iOS📲) platforms (⚠️For android you need to make minSdkVersion 22 in build.gradle file)
  • Easy integration
  • Customization
  • Localization (Current support for English 🇺🇸 and Urdu 🇵🇰)
  • Searching🔍 and sharing👯
  • Json request and responses in tree form
  • Json request and response in pretty json format
  • Image URL preview
  • ChuckerHttpLoggingInterceptor for better readability of http request and response sent from client. To use this just add this interceptor in your ChopperClient
final exampleClient = ChopperClient(
  services: [
    _$ChopperApiService(),
  ],
  interceptors: [
    ChuckerHttpLoggingInterceptor() //This for logging,
    ChuckerChopperInterceptor(),
  ],
);

image

Libraries

Chucker FLutter uses the following open source libraries:

Patrons

I extend my sincere appreciation to all the sponsors. Thank you for making a difference in the open source community!❤️ (You can also sponsor my work, please visit patreon.com)


Rafay Ali

Contributors

Special thanks to these wonderful people👏 who are making our community bigger and better🔥


Adeyemo Adedamola

📖

fachrifaul

📖

Navneet Singh

📖

Sergei

📖

Syifa Ainnur

📖

Erick Armen

📖

Aleksandr Lozhkovoi

📖

Leo Ngo

📖

Kashyap Bhat

📖

KeeganDC

📖

Mateen Mehmood

📖

Cuong Nguyen

📖

License

MIT License

Copyright (c) 2022 Syed Murtaza

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

所屬分類

依賴

依賴清單 5 項

原始碼儲存庫

使用此套件的專案