パッケージ、リポジトリ、アプリカテゴリを検索

flutter_alice のカバー
パッケージ詳細v3.0.0

flutter_alice

AliceはHTTPリクエストのデバッグを支援するHTTPインスペクターツールです。HTTPリクエストとレスポンスをキャッチして保存し、シンプルなUIで確認できます。

AndroidiOSmacOSWindowsLinux
30日間ダウンロード
1.2万
いいね数
52
Pub ポイント
140

パッケージをインストール

flutter pub add flutter_alice

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

Flutter Alice は、HTTP リクエスト用のデバッグツールで、すべての送信リクエストとその応答をキャプチャして保存します。ヘッダー、ボディ、ステータスコード、タイミングなどを含む各リクエストおよび応答の詳細情報を確認できる、シンプルで直感的な UI を提供します。アプリ開発やテスト中に開発者にとって理想的であり、API 通信における問題を迅速に特定するのに役立ちます。このツールは Flutter アプリにシームレスに統合でき、Android、iOS、macOS、Windows、Linux など複数のプラットフォームをサポートしており、幅広く利用可能です。オープンソースであるため、透明性が保たれ、コミュニティからの貢献も可能になっています。

用途

  • 開発中の API 呼び出しのデバッグ
  • リクエスト/レスポンスのヘッダーと本文の確認
  • ネットワークパフォーマンスのモニタリング
  • RESTful サービスのテスト
  • 失敗したHTTPリクエストのトラブルシューティング

主な機能

  • リアルタイムHTTPリクエストログ
  • インタラクティブなウェブベースの検査UI
  • すべての主要プラットフォームをサポートしています
  • pub.dev を通じた簡単な統合
  • オープンソースでカスタマイズ可能

適している対象

  • Flutter開発者
  • API テスター
  • モバイルアプリデバッガー
  • フロントエンドエンジニア
  • ネットワーク問題に関するチーム協力

注意事項

  • プロダクションビルドには推奨されていません
  • 開発モードで手動で有効にする必要があります
  • UIは複雑なデータ構造に適していない可能性があります
  • HTTPトラフィックのみに制限
  • 重い使用時にパフォーマンスにわずかな影響を与える可能性があります

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

A ⭐ star on GitHub repo is the greatest motivation for me

to keep improving this project! 💖

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) and Chucker (https://github.com/ChuckerTeam/chucker).

Overlay bubble version of Alice: https://github.com/jhomlala/alice

Supported Dart http client plugins:

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

Features:
✔️ Detailed logs for each HTTP calls (HTTP Request, HTTP Response)
✔️ Inspector UI for viewing HTTP calls
✔️ Statistics
✔️ Support for top used HTTP clients in Dart
✔️ Error handling
✔️ HTTP calls search ✔️ Bubble overlay entry

Install

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

Usage

Alice configuration
  1. Create Alice instance:
// Define a navigator key
final navigatorKey = GlobalKey<NavigatorState>();

// Create Alice with the navigator key
final alice = Alice(navigatorKey: navigatorKey);
  1. Add navigator key to your application:
MaterialApp(
  navigatorKey: navigatorKey,
  home: YourHomeWidget(),
)

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

  1. Optional: To use bubble overlay, wrap your app with OverlaySupport:
// Don't forget to import overlay_support package
import 'package:overlay_support/overlay_support.dart';

OverlaySupport(
  child: MaterialApp(
    navigatorKey: navigatorKey,
    home: YourHomeWidget(),
  ),
)
HTTP Client configuration
For Dio

Add interceptor to your Dio instance:

final dio = Dio();
dio.interceptors.add(alice.getDioInterceptor());
For HTTP package

You can use extension methods for cleaner code:

// Import extensions
import 'package:flutter_alice/core/alice_http_extensions.dart';

// Use extension methods
http
  .get(Uri.parse('https://jsonplaceholder.typicode.com/posts'))
  .interceptWithAlice(alice);

// For POST requests with body
http
  .post(Uri.parse('https://jsonplaceholder.typicode.com/posts'), body: body)
  .interceptWithAlice(alice, body: body);

Or use the standard approach:

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

// For POST requests with body
http.post(Uri.parse('https://jsonplaceholder.typicode.com/posts'), body: body).then((response) {
  alice.onHttpResponse(response, body: body);
});
For HttpClient from dart:io

You can use extension methods:

// Import extensions
import 'package:flutter_alice/core/alice_http_client_extensions.dart';

// Use extension methods
httpClient
  .getUrl(Uri.parse("https://jsonplaceholder.typicode.com/posts"))
  .interceptWithAlice(alice);

// For POST requests with body
httpClient
  .postUrl(Uri.parse("https://jsonplaceholder.typicode.com/posts"))
  .interceptWithAlice(alice, body: body, headers: Map());

Or use the standard approach:

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

### Opening the Inspector
You can open the inspector UI in different ways:

```dart
// Open directly
ElevatedButton(
  child: Text("Open Inspector"),
  onPressed: alice.showInspector,
)

// Or call from anywhere in your code
alice.showInspector();

カテゴリー

依存関係

依存関係一覧 4 件

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。