Debugging Network Calls in Flutter with Alice

By | June 21, 2022

In this article I am showing a useful plugin to debug network calls in Flutter.
Alice! You can find the alice package here.

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 simple to integrate!

First add the dependency in pubspec.yaml.

[java]
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.3
alice: ^0.2.5
http: ^0.13.4
[/java]


Create instance of Alice.

[java]
Alice alice = Alice();
[/java]

Attach alice to your network calls.

[java]

import ‘package:http/http.dart’ as http;

final response = await http
.get(Uri.parse(‘https://jsonplaceholder.typicode.com/posts/1’));

if (kDebugMode) alice.onHttpResponse(response);

[/java]


Open Debug info UI

After the network call has been made, you can open up alice inspector using the below code.

[java]
alice.showInspector();
[/java]


Debug network calls flutter

Find me on
Medium: https://vipinvijayannair.medium.com
Facebook: https://www.facebook.com/contactvipinvijayan
Twitter: @mr_vipin_nair
Page: https://www.facebook.com/Mobile-Tutor-299932940922778

Leave a Reply

Your email address will not be published. Required fields are marked *