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

dio_log 封面
套件詳情v5.3.0+3

dio_log

一個插件,可捕獲請求並在應用內檢視,提供請求複製和JSON展開等功能

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
418
喜歡數
61
Pub 分數
140

安裝套件

flutter pub add dio_log

套件介紹

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

Dio Log 是一個用於 Flutter 應用程式的除錯工具,可與 Dio HTTP 客戶端整合,以在應用程式內擷取並顯示網路請求。它讓開發者能夠檢視請求細節,包括標頭、內容和回應,並具備 JSON 展開功能,以提升可讀性。該套件支援請求複製功能,讓使用者可直接從 UI 中重新執行失敗或重要的請求。專為開發與測試設計,可增強對 Android、iOS、Web、macOS、Windows 及 Linux 平台上的 HTTP 互動之可見性。

適用情境

  • 即時除錯 API 呼叫
  • 重播失敗的 HTTP 請求
  • 檢查複雜的 JSON 回應
  • 在開發過程中測試網路行為
  • 監控應用程式中的請求/回應週期
  • 驗證 API 結合工作流程

主要特色

  • 應用內請求視覺化
  • 結構化數據的JSON擴展
  • 請求複製功能
  • 跨平台支援
  • 即時記錄與 Dio
  • 透過 pub add 簡單整合

適合對象

  • Flutter 開發人員在除錯模式下
  • Teams 測試 API 集成
  • 需要詳細網絡檢查的應用程式
  • 前端工程師排查HTTP問題
  • 使用 Dio 進行 HTTP 操作的開發者
  • 頻繁更換 API 的專案

使用建議

  • 不適用於生產使用
  • 可能影響大規模記錄的效能
  • 需要在程式碼中手動啟用
  • 僅限開發環境
  • 無內建匯出或持久化功能
  • 使用者介面可能未針對所有螢幕尺寸進行最佳化

原始 README

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

dio_log

pub package

English | 中文

Description

HTTP Inspector tool for Dart which can debugging http requests. Currently, DIO based HTTP capture is implemented. Of course, you can implement an Interceptor instead of a DiologInterceptor to adapt to other HTTP clients.

Installation

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

dependencies:
  dio_log: 5.3.0+1

Usage

  1. Set interceptor of dio:
dio.interceptors.add(DioLogInterceptor());
  1. Add a global hover button on your home page:
// Display overlay button
showDebugBtn(context, btnColor: Colors.blue);
// Cancel overlay button
dismissDebugBtn();
// Check overlay button state
debugBtnIsShow()
  1. Or open log list manually:
Navigator.of(context).push(
  MaterialPageRoute(
    builder: (context) => HttpLogListWidget(),
  ),
);

Configuration

// Sets the maximum number of entries for logging
LogPoolManager.getInstance().maxCount = 100;
// Add custom error detection
LogPoolManager.getInstance().isError = (res) => res.resOptions==null;
// Disable Log Printing
DioLogInterceptor.enablePrintLog = false;

Screenshots

Demo

gif

所屬分類

依賴

依賴清單 1 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。