Chucker Flutter inspects the HTTP(S) requests/responses triggered by your Flutter App. It works as an Interceptor and stores data related to network requests and responses on local storage, providing a UI for inspecting and sharing their content.

Flutter Apps, using Chucker Flutter, show in-app notifications that tell the status (e.g. 200, 400, 500 and so) and requested URL and upon clicking on the details button it navigates to the Chucker Flutter main screen. You cannot manipulate Chucker Flutter behaviour using its setting by navigating to the Settings page from the menu button of the Chucker Flutter main page.

Getting Started:

To use Chucker Flutter you need to add the pub spec dependency to your pubspec.yaml file of your Flutter app.

Please verify the latest version of Chucker Flutter so you can enjoy the latest features.

dependencies:
  chucker_flutter: latest-version

or

just run the command

flutter pub add chucker_flutter

To make Chucker Flutter work in Dio, add it to your Dio object e.g.:

Dio().interceptors.add(ChuckerDioInterceptor());

To make Chucker Flutter work in Http, you need to use ChuckerHttpClient object e.g.:

final _chuckerHttpClient = ChuckerHttpClient(http.Client());
_chuckerHttpClient.get(Uri.parse('$_baseUrl$path'));

To make Chucker Flutter work in Chopper, you need to use ChuckerChopperInterceptor object e.g.:

final client = ChopperClient(
        baseUrl: 'https://jsonplaceholder.typicode.com',
        interceptors: [
          ChuckerChopperInterceptor(),
        ]
);

The very last thing is to connect Chucker Flutter screens to your app. To do so, you only need to add Chucker Flutter NavigatorObserver to your app’s MaterialApp e.g.:

MaterialApp(
      ...,
      navigatorObservers: [ChuckerFlutter.navigatorObserver],

By default, Chucker Flutter only runs in debug mode but you can allow it to run in release mode too using its showOnRelease property e.g.:

void main() {
  ChuckerFlutter.showOnRelease = true;
  runApp(const App());
}

Congratulations! You are done.

You may also like

Leave a Reply