All Projects → jhomlala → Alice

jhomlala / Alice

Licence: apache-2.0
HTTP Inspector for Flutter. Allows checking HTTP connections with UI inspector.

Programming Languages

dart
5743 projects
dartlang
94 projects

Projects that are alternatives of or similar to Alice

A-Complete-Guide-To-Flutter
This repo contains all the small snippets related to Flutter Apps. Most of the projects/apps are deployed on Flutter Web using GitHub Actions CI Pipeline.
Stars: ✭ 70 (-76.35%)
Mutual labels:  flutter-plugin
http middleware
A middleware library for Dart's http library.
Stars: ✭ 38 (-87.16%)
Mutual labels:  flutter-plugin
Qrcode scanner
🛠 Flutter QR code scanner plugin.
Stars: ✭ 274 (-7.43%)
Mutual labels:  flutter-plugin
flutter paystack
💳 A robust Flutter plugin for making payments via Paystack Payment Gateway. Completely supports Android and iOS
Stars: ✭ 146 (-50.68%)
Mutual labels:  flutter-plugin
flutter qq ads
🔥🔥🔥 Flutter 广告插件 -- 优量汇 、广点通、腾讯广告(支持开屏、插屏、激励视频、Banner、信息流、视频贴片)
Stars: ✭ 51 (-82.77%)
Mutual labels:  flutter-plugin
Flutter i18n
This plugin create a binding between your translations from .arb files and your Flutter app.
Stars: ✭ 255 (-13.85%)
Mutual labels:  flutter-plugin
x5 webview flutter
一个基于腾讯x5引擎的webview flutter插件,简化集成,一行代码打开视频播放,暂时只支持android使用
Stars: ✭ 90 (-69.59%)
Mutual labels:  flutter-plugin
Webinspector
Ruby gem to inspect completely a web page. It scrapes a given URL, and returns you its meta, links, images more.
Stars: ✭ 288 (-2.7%)
Mutual labels:  inspector
slyblime
Interactive Lisp IDE with REPL, Inspector, Debugger and more for Sublime Text 4.
Stars: ✭ 35 (-88.18%)
Mutual labels:  inspector
Unity Editor Toolbox
Tools, custom attributes, drawers, hierarchy overlay, and other extensions for the Unity Editor.
Stars: ✭ 273 (-7.77%)
Mutual labels:  inspector
iap
Flutter plugin for interacting with iOS StoreKit and Android Billing Library
Stars: ✭ 18 (-93.92%)
Mutual labels:  flutter-plugin
Smart-Inspector
Fluent re-take on Unity Inspector UX. Packed with QoL improvements.
Stars: ✭ 680 (+129.73%)
Mutual labels:  inspector
Flutter tts
Flutter Text to Speech package
Stars: ✭ 263 (-11.15%)
Mutual labels:  flutter-plugin
cross connectivity
A Flutter plugin for handling Connectivity and REAL Connection state in the mobile, web and desktop platforms. Supports iOS, Android, Web, Windows, Linux and macOS.
Stars: ✭ 27 (-90.88%)
Mutual labels:  flutter-plugin
Simple auth
The Simplest way to Authenticate in Flutter
Stars: ✭ 276 (-6.76%)
Mutual labels:  flutter-plugin
Organismo-Desktop
3D Virtual Environment for Mobile Devices. Electron Desktop Application.
Stars: ✭ 31 (-89.53%)
Mutual labels:  inspector
flutter simple dependency injection
A super simple dependency injection implementation for flutter that behaviours like any normal IOC container and does not rely on mirrors
Stars: ✭ 91 (-69.26%)
Mutual labels:  flutter-plugin
Google nav bar
A modern google style nav bar for flutter.
Stars: ✭ 290 (-2.03%)
Mutual labels:  flutter-plugin
Flutter swiper
The best swiper for flutter , with multiple layouts, infinite loop. Compatible with Android & iOS.
Stars: ✭ 3,209 (+984.12%)
Mutual labels:  flutter-plugin
Stream Chat Flutter
Stream Chat official Flutter SDK. Build your own chat experience using Dart and Flutter.
Stars: ✭ 220 (-25.68%)
Mutual labels:  flutter-plugin

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 and Chucker.

Supported Dart http client plugins:

  • Dio
  • HttpClient from dart:io package
  • Http from http/http package
  • Chopper
  • Generic HTTP client

Features:
✔️ Detailed logs for each HTTP calls (HTTP Request, HTTP Response)
✔️ Inspector UI for viewing HTTP calls
✔️ Save HTTP calls to file
✔️ Statistics
✔️ Notification on HTTP call
✔️ Support for top used HTTP clients in Dart
✔️ Error handling
✔️ Shake to open inspector
✔️ HTTP calls search

Install

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

Usage

Alice configuration

  1. Create Alice instance:
Alice alice = Alice();
  1. Add navigator key to your application:
MaterialApp( navigatorKey: alice.getNavigatorKey(), home: ...)

You need to add this navigator key in order to show inspector UI. You can use also your navigator key in Alice:

Alice alice = Alice(showNotification: true, navigatorKey: yourNavigatorKeyHere);

If you need to pass navigatorKey lazily, you can use:

alice.setNavigatorKey(yourNavigatorKeyHere);

This is minimal configuration required to run Alice. Can set optional settings in Alice constructor, which are presented below. If you don't want to change anything, you can move to Http clients configuration.

Additional settings

You can set showNotification in Alice constructor to show notification. Clicking on this notification will open inspector.

Alice alice = Alice(..., showNotification: true);

You can set showInspectorOnShake in Alice constructor to open inspector by shaking your device (default disabled):

Alice alice = Alice(..., showInspectorOnShake: true);

If you want to use dark mode just add darkTheme flag:

Alice alice = Alice(..., darkTheme: true);

If you want to pass another notification icon, you can use notificationIcon parameter. Default value is @mipmap/ic_launcher.

Alice alice = Alice(..., notificationIcon: "myNotificationIconResourceName");

If you want to limit max numbers of HTTP calls saved in memory, you may use maxCallsCount parameter.

Alice alice = Alice(..., maxCallsCount: 1000));

HTTP Client configuration

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);
});

If you're using Chopper. you need to add interceptor:

chopper = ChopperClient(
    interceptors: alice.getChopperInterceptor(),
);

If you have other HTTP client you can use generic http call interface:

AliceHttpCall aliceHttpCall = AliceHttpCall(id);
alice.addHttpCall(aliceHttpCall);

Show inspector manually

You may need that if you won't use shake or notification:

alice.showInspector();

Saving calls

Alice supports saving logs to your mobile device storage. In order to make save feature works, you need to add in your Android application manifest:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Extensions

You can use extensions to shorten your http and http client code. This is optional, but may improve your codebase. Example:

  1. Import:
import 'package:alice/core/alice_http_client_extensions.dart';
import 'package:alice/core/alice_http_extensions.dart';
  1. Use extensions:
http
    .post('https://jsonplaceholder.typicode.com/posts', body: body)
    .interceptWithAlice(alice, body: body);
httpClient
    .postUrl(Uri.parse("https://jsonplaceholder.typicode.com/posts"))
    .interceptWithAlice(alice, body: body, headers: Map());

Example

See complete example here: https://github.com/jhomlala/alice/blob/master/example/lib/main.dart To run project, you need to call this command in your terminal:

flutter pub run build_runner build --delete-conflicting-outputs

You need to run this command to build Chopper generated classes. You should run this command only once, you don't need to run this command each time before running project (unless you modify something in Chopper endpoints).

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].