flutter_alice 2.1.0-beta.1 copy "flutter_alice: ^2.1.0-beta.1" to clipboard
flutter_alice: ^2.1.0-beta.1 copied to clipboard

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.

example/lib/main.dart

import 'dart:io';

// import 'package:chopper/chopper.dart' hide Options;
import 'package:alice_example/home_page.dart';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter_alice/alice.dart';

// Navigator key
final navigatorKey = GlobalKey<NavigatorState>();

final alice = Alice();
final dio = Dio(BaseOptions(followRedirects: false));
final httpClient = HttpClient();

void main() {
  // Set up Alice to use the navigator key
  // alice.setNavigatorKey(navigatorKey);
  // Alice Capture all HTTP requests and responses in debug mode
  // Attach alice into Dio (only onetime)
  //
  // // Capture for chopper
  // _chopper = ChopperClient(
  //   interceptors: alice.getChopperInterceptor(),
  // );
  // _postsService = PostsService.create(_chopper);

  // if (kDebugMode) dio.interceptors.add(alice.getDioInterceptor());

  // alice.clearLogs();
  alice.log("Alice is running!", color: Colors.yellow);
  alice.log(StackTrace.current.toString(), color: Colors.yellow);

  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return AliceInspector(
      debug: true,
      dios: [dio],
      navigatorKey: navigatorKey,
      child: MaterialApp(
        navigatorKey: navigatorKey,
        debugShowCheckedModeBanner: false,
        home: HomePage(),
      ),
    );
  }
}
41
likes
130
points
7.2k
downloads
screenshot

Publisher

verified publisherfreetalk.io.vn

Weekly Downloads

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

Topics

#alice #dio #inspector #network #http

Documentation

API reference

Funding

Consider supporting this project:

github.com

License

Apache-2.0 (license)

Dependencies

cupertino_icons, dio, flutter, http, rxdart, share_plus

More

Packages that depend on flutter_alice