alice 0.0.3 copy "alice: ^0.0.3" to clipboard
alice: ^0.0.3 copied to clipboard

outdated

Alice is an HTTP Inspector tool which helps debugging http requests. It catches and stores http requests and responses, which can be viewed via simple UI.

Alice #

pub package pub package pub package

Alice is an HTTP Inspector tool for Flutter which helps debugging http requests. It catches and stores http requests and responses, which can be viewed via simple UI. It is inspired from Chuck (https://github.com/jgilfelt/chuck).

Alice supports http clients:

  • Dio
  • HttpClient from dart:io package
  • Http from http/http package

Install #

  1. Add this to your package's pubspec.yaml file:
dependencies:
  alice: ^0.0.2
  1. Install it
$ flutter packages get
  1. Import it
import 'package:alice/alice.dart';

How to use #

Create Alice instance:

  Alice alice = Alice(showNotification: true);

Alice default behaviour is to show notification with http requests. You can disable it Alice constructor.

Add navigator key to your application:

  MaterialApp( navigatorKey: alice.getNavigatorKey(), home: ...)

You need to add this navigator key in order to show inspector UI.

If you're using Dio, you just need to add interceptor.

  Dio dio = Dio();
  dio.interceptors.add(alice.getDioInterceptor());

If you're using HttpClient from dart:io package:

    httpClient
        .getUrl(Uri.parse("https://jsonplaceholder.typicode.com/posts"))
        .then((request) async {
      alice.onHttpClientRequest(request);
      var httpResponse = await request.close();
      var responseBody = await httpResponse.transform(utf8.decoder).join();
      alice.onHttpClientResponse(httpResponse, request, body: responseBody);
    });

If you're using http from http/http package:

    http.get('https://jsonplaceholder.typicode.com/posts').then((response) {
      alice.onHttpResponse(response);
    });

To show inspector manually:

  alice.showInspector();

See complete example here: https://github.com/jhomlala/alice/blob/master/example/lib/main.dart

268
likes
0
pub points
97%
popularity

Publisher

unverified uploader

Alice is an HTTP Inspector tool which helps debugging http requests. It catches and stores http requests and responses, which can be viewed via simple UI.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

dio, flutter, flutter_local_notifications, http, rxdart

More

Packages that depend on alice