RequestsInspector 是一個專為調試 HTTP 和 GraphQL 請求而設計的 Flutter 套件。它會記錄所有發出的 API 調用,並透過搖動裝置即時存取請求/回應資料,顯示專用的檢查器小部件。非常適合需要快速檢視網路活動而無需修改程式碼的開發者。該套件支援 Android 和 iOS 平台,並可與現有的 HTTP 客戶端(如 dio 或 http)無縫整合。其輕量級設計確保對效能影響極小。
適用情境
除錯 API 端點
監控 GraphQL 查詢
檢查請求標頭和正文
開發期間的即時網路日誌記錄
疑難排解失敗的請求
主要特色
搖動以開啟檢視器
支援 HTTP 和 GraphQL
跨平台(Android 與 iOS)
所需設定最少
即時請求/回應檢視
適合對象
Flutter 開發人員在除錯模式下
Teams 測試 API 集成
前端工程師排錯網路問題
使用 REST/GraphQL 的行動應用開發者
任何需要快速網絡檢查的人
使用建議
不適用於生產使用
需要實體裝置才能進行搖晃手勢
僅限除錯版本
日誌無持久化儲存
某些設備可能需要權限
原始 README
以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。
requests_inspector 🕵
A Flutter package for logging API requests (Http Requests & GraphQL) requests.
Main Features:
Log your Http request, GraphQL and WebSockets.
Intercept your requests and responses for testing.
Share request details as json, cURL, or HAR file to re-run it again (ex. Postman).
And more and more
To get the RequestsInspector widget on your screen:
📱💃 : Shake your phone.
📱👈 : Long-Press on any free space on the screen.
Also you can share the request details as (Log, cURL command, or HAR file) with your team to help them debug the API requests.
From Inspector to Postman 🧡 🎉️
Now you can extract cURL command from the inspector to send the request again from your terminal or Postman 💪💪
HAR File Support 📦 🎉️
You can now share requests as HAR (HTTP Archive) files! HAR files are a standard format that can be imported into various tools like Postman, Proxyman, or any HAR-compatible tool for debugging and analysis. You can share HAR files in two formats:
HAR text: Copy the HAR content as text
HAR file (.har): Share as a downloadable .har file
The HAR format includes complete request/response details, headers, timing information, and more, making it perfect for comprehensive API debugging and sharing with your team.
Setup
First, add it at the top of your MaterialApp with enabled: true.