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.