requests_inspector_plus 1.1.0
requests_inspector_plus: ^1.1.0 copied to clipboard
Flutter REST API and GraphQL request logger with capture control, sensitive-data masking, operation labels, and a shake-to-open inspector.
requests_inspector_plus ๐ต #
A Flutter package for logging API requests (Http Requests & GraphQL) requests.
requests_inspector_plusis a fork ofrequests_inspectorby Abdelazeem Kuratem, extended with runtime capture gating, sensitive-data masking and GraphQL operation labelling.
Main Features: #
- Log your
Http request,GraphQLandWebSockets. - Intercept your requests and responses for testing.
- Share request details as json,
cURL, orHARfile 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
.harfile
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 #
Requires Flutter >=3.47.0 and Dart >=3.13.0. The inspector's own app and
exported stopper dialogs use modern Material UI types. See the changelog for
the import migration. They work under a modern MaterialApp without a
compatibility bridge. No theme types are re-exported. Request/response models,
stopper callbacks and the host GlobalKey<NavigatorState> API are unchanged.
For localized hosts, configure GlobalMaterialLocalizations.delegates together
with your supportedLocales. Stopper routes use the
host's localizations and navigator while keeping the inspector's selected
light/dark theme and left-to-right editor layout. The inspector's own app
continues to use its independent theme and default English localizations.
To test local changes before publication, override the app's dependency:
dependency_overrides:
requests_inspector_plus:
path: ../requests_inspector
First, add it at the top of your MaterialApp with enabled: true.
void main() {
runApp(const RequestsInspector(
child: MyApp(),
));
}
1. RESTful API: #
Using Dio, pass by RequestsInspectorInterceptor() to Dio.interceptors and we are good to go ๐๏ธ๐๏ธ.
final dio = Dio()..interceptors.add(RequestsInspectorInterceptor());
Masking sensitive information
Pass a SensitiveDataMasker to redact secret values (tokens, passwords,
cookies, ...) from the headers, query parameters, request body, GraphQL
variables and response body before they are stored for display. Masking is
applied only to the logged copy โ the real outgoing request and the live
response are never altered.
final dio = Dio()
..interceptors.add(
RequestsInspectorInterceptor(
// Uses SensitiveDataMasker.defaultMaskedKeys when `maskedKeys` is omitted.
masker: SensitiveDataMasker(
maskedKeys: {'authorization', 'password', 'staticToken'},
placeholder: '***',
// Optional: customize the masked value per key.
// maskValueBuilder: (key, value) => '<redacted $key>',
),
),
);
Matching is by key name, case-insensitively, and works recursively through nested maps/lists and even JSON encoded inside string values.
Toggling capture at runtime
Pass an isEnabled ValueListenable<bool> (e.g. a ValueNotifier) to turn
capture on/off at runtime โ while it is false nothing is recorded and the
request/response stoppers are skipped. When omitted, capture is always on.
final networkLogEnabled = ValueNotifier<bool>(false);
final dio = Dio()
..interceptors.add(
RequestsInspectorInterceptor(isEnabled: networkLogEnabled),
);
// later, from a developer-options switch:
networkLogEnabled.value = true;
If you don't use Dio then don't worry #
In your API request just add a new RequestDetails using RequestInspectorController filled with the API data.
InspectorController().addNewRequest(
RequestDetails(
requestName: requestName,
requestMethod: RequestMethod.GET,
url: apiUrl,
queryParameters: params,
statusCode: responseStatusCode,
responseBody: responseData,
),
);
Real Restful example #
a. Normal InspectorController().addNewRequest.
Future<List<Post>> fetchPosts() async {
final dio = Dio();
final params = {'userId': 1};
final response = await dio.get(
'[https://jsonplaceholder.typicode.com/posts](https://jsonplaceholder.typicode.com/posts)',
queryParameters: params,
);
final postsMap = response.data as List;
final posts = postsMap.map((postMap) => Post.fromMap(postMap)).toList();
InspectorController().addNewRequest(
RequestDetails(
requestName: 'Posts',
requestMethod: RequestMethod.GET,
url: '[https://jsonplaceholder.typicode.com/posts](https://jsonplaceholder.typicode.com/posts)',
queryParameters: params,
statusCode: response.statusCode ?? 0,
responseBody: response.data,
),
);
return posts;
}
b. Using RequestsInspectorInterceptor.
Future<List<Post>> fetchPosts() async {
final dio = Dio()..interceptors.add(RequestsInspectorInterceptor());
final response = await dio.get('[https://jsonplaceholder.typicode.com/posts](https://jsonplaceholder.typicode.com/posts)');
final postsMap = response.data as List;
final posts = postsMap.map((postMap) => Post.fromMap(postMap)).toList();
return posts;
}
Finaly, Shake your phone to get the Inspector #

2. GraphQl: #
To use requests_inspector_plus with graphql_flutter library.
you jus need to wrap your normal HttpLink with our GraphQLInspectorLink and we are done.
Example:
Future<List<Post>> fetchPostsGraphQlUsingGraphQLFlutterInterceptor() async {
Future<List<Post>> fetchPostsGraphQlUsingGraphQLFlutterInterceptor() async {
final client = GraphQLClient(
cache: GraphQLCache(),
link: Link.split(
(request) => request.isSubscription,
GraphQLInspectorLink(WebSocketLink('ws://graphqlzero.almansi.me/api')),
GraphQLInspectorLink(HttpLink('[https://graphqlzero.almansi.me/api](https://graphqlzero.almansi.me/api)')),
),
);
const query = r'''query {
post(id: 1) {
id
title
body
}
}''';
final options = QueryOptions(document: gql(query));
final result = await client.query(options);
if (result.hasException) {
log(result.exception.toString());
} else {
log(result.data.toString());
}
var post = Post.fromMap(result.data?['post']);
return [post];
}
Stopper (Requests & Responses) #
requests_inspector_plus (Stopper) enables your to stop and edit requests (before sending it to server) and responses (before receiving it inside the app).
- First, you need to add navigatorKey to your
MaterialAppthen pass it toRequestsInspectorto show Stopper dialogs.
final navigatorKey = GlobalKey<NavigatorState>();
void main() => runApp(
RequestsInspector(
// Add your `navigatorKey` to enable `Stopper` feature
navigatorKey: navigatorKey,
child: const MyApp(),
),
);
// ...
@override
Widget build(BuildContext context) {
return MaterialApp(
navigatorKey: navigatorKey, // <== Here!
// ...
- Second, just enable it from Inspector and it will stop all your requests and responses.
For Web, Windows, MacOS and Linux #
Obviously, The shaking won't be good enough for those platforms ๐
So you can specify showInspectorOn with ShowInspectorOn.LongPress.
void main() {
runApp(const RequestsInspector(
enabled: true,
showInspectorOn: ShowInspectorOn.LongPress
child: MyApp(),
));
}
OR, you can just pass ShowInspectorOn.Both to open the Inspector with Shaking or with LongPress.
void main() {
runApp(const RequestsInspector(
enabled: true,
showInspectorOn: ShowInspectorOn.Both,
child: MyApp(),
));
}
Some images #

๐ค Contributors #
Contributors helping improve requests_inspector_plus: ๐ป๐จ๐๐ง
|
Abdelazeem |
Belal |
Mostafa |
Abdelrahman |
Anthony |
|
M Hussein |
Vadym |
M Gawdat |
Anas |
Moaz |
|
Michelle |
Abdullah |
Ahmed |
Nourhan |
Anthony |
|
Dwiky |
How to Contribute #
We welcome contributions from everyone! Here's how you can help:
- Report Issues: Found a bug or have a feature request? Open an issue
- Submit Pull Requests: Have a fix or improvement? We'd love to review your PR!
- Improve Documentation: Help us make the docs clearer and more comprehensive
- Share Feedback: Let us know how you're using the package and what could be better
To add yourself as a contributor, simply follow the contribution guidelines and your efforts will be recognized here!
Releasing #
GitHub Actions runs CI on pull requests and pushes to main, followed by
automatic version tagging and OIDC publishing to
pub.dev. CI tests the library, example and release script with Flutter 3.50.0.
Existing analyzer info notices are allowed; errors and warnings fail CI.
One-time setup:
- Add the repository secret
RELEASE_PAT, using a token that can push tags todwikyhardi/requests_inspector(Contents: read/write). A tag pushed with the defaultGITHUB_TOKENcannot trigger the publishing workflow. - In the pub.dev package's automated publishing settings, authorize the GitHub
repository
dwikyhardi/requests_inspectorwith tag patternrequests_inspector_plus-v{{version}}. The publishing workflow is.github/workflows/publish.yml; no pub.dev token secret is needed.
To release, update version in pubspec.yaml and add its changelog entry, then
merge to main. After CI succeeds, Auto Tag Release skips already published
versions, validates an unpublished version with flutter pub publish --dry-run,
and pushes requests_inspector_plus-v<version>. Publish requests_inspector_plus
checks that the tag matches the pubspec and belongs to main, then publishes via
the official Dart reusable workflow with OIDC.
To retry tagging after fixing setup, manually run Auto Tag Release on main
after CI has passed. If the tag already exists, rerun its failed publishing job
instead; existing tags are never moved.
Future plans: #
- โ
Add support for
GraphQL. - โ
Enhance the
GraphQLrequest and response displaying structure. - โ Improve the request tab UI and add expand/collapse for each data block.
- โ Better UI.
- โ Support Dark/Light Modes.
- โ Powerful JSON Tree View.
- โ Collapsable separated sections.
- โ Click to Copy Content of each section.
- โ 'WillPopScope' is deprecated and shouldn't be used. Use PopScope instead. The Android predictive back feature will not work with WillPopScope.
- โ Add search inside the request details page.
- โ Add Http Interceptor.
๐ License #
This project is licensed under the MIT License - see the LICENSE file for details.