dio_shaker_interceptor 0.1.1 copy "dio_shaker_interceptor: ^0.1.1" to clipboard
dio_shaker_interceptor: ^0.1.1 copied to clipboard

Shake to debug! dio_shaker_interceptor shows network request details. Inspect HTTP data easily with this Dio interceptor.

dio_shaker_interceptor #

The dio_shaker_interceptor package provides a Dio interceptor that allows you to easily inspect and debug network requests by shaking your device. It captures and displays detailed information about HTTP requests and responses, facilitating efficient development and troubleshooting.

Features #

  • Capture and display detailed information about HTTP requests and responses.
  • Shake your device to trigger the interceptor and view the network details.
  • View request URL, method, headers, body, query parameters, status, and response.
  • Easily integrate with your existing Dio setup.

Usage #

To use the dio_shaker_interceptor package, follow these steps:

  1. Add Dependency:

    Add the dio_shaker_interceptor package to your pubspec.yaml file:

    dependencies:
      dio_shaker_interceptor: ^0.0.1
    
  2. Import the Package:

    Import the dio_shaker_interceptor package in your Dart file:

    import 'package:dio_shaker_interceptor/dio_shaker_interceptor.dart';
    
  3. Initialize Dio and Add Interceptor:

    Create an instance of Dio and add the DioShakerInterceptor to the interceptors list:

    import 'package:dio/dio.dart';
    import 'package:dio_shaker_interceptor/dio_shaker_interceptor.dart';
    
    void main() {
      final dio = Dio();
    
      // Add the DioShakerInterceptor to the Dio instance
      dio.interceptors.add(DioShakerInterceptor());
    }
    
  4. Integrate Shake Detection:

    Integrate the detectShakeAndOpenListCurlScreen function within the build method to enable the detection of the device's shake event and subsequently invoke the display of the cURL request list screen.

    In this example, the navigatorKey is passed as a parameter, while the buildContext is set to null. This is the recommended approach.

    @override
    Widget build(BuildContext context) {
      ShakerDioDetect.detectShakeAndOpenListCurlScreen(
        buildContext: null,
        navigatorKey: navigatorKey,
      );
    }
    

    Note: Ensure you have a global navigatorKey defined in your Flutter application.

    Example 2 (Alternative) #

    In this example, the buildContext is passed as a parameter, while the navigatorKey is set to null.

    @override
    Widget build(BuildContext context) {
      ShakerDioDetect.detectShakeAndOpenListCurlScreen(
        buildContext: context,
        navigatorKey: null,
      );
    }
    

    Note: This approach relies on the context being available at the time of the shake event.

  5. Shake Device to Inspect Requests:

    Shake your device to trigger the interceptor and view the network details. The interceptor will capture and display detailed information about HTTP requests and responses, including URL, method, headers, body, query parameters, status, and response.

3
likes
150
points
98
downloads

Documentation

API reference

Publisher

verified publisherbreight-code.it

Weekly Downloads

Shake to debug! dio_shaker_interceptor shows network request details. Inspect HTTP data easily with this Dio interceptor.

Homepage
Repository (GitHub)
View/report issues

License

BSD-3-Clause (license)

Dependencies

collection, dio, equatable, flutter, flutter_bloc, flutter_localizations, get_it, path_provider, sensors_plus, share_plus

More

Packages that depend on dio_shaker_interceptor