Skip to content

murzagalin/http_ui_logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

http_ui_logger

This package is a simple http inspector for dart http clients. It intercepts and stores all HTTP responses (including their requests) inside your application, and provides a UI for inspecting their content.

Installing

  1. Depend on it Add this to your package's pubspec.yaml file:
dependencies:
  http_ui_logger: ^0.0.3
  1. Install it You can install packages from the command line:
$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

  1. Import it Now in your Dart code, you can use:
import 'package:http_ui_logger/LoggerClient.dart';
import 'package:http_ui_logger/ResponseListWidget.dart';

Using

Intercept requests

You have two options:

  • Create a logger client:
import 'package:http_ui_logger/LoggerClient.dart';

...

final client = LoggerClient.client()

//sample request
client.get('https://www.googleapis.com/books/v1/volumes?q={http}');
  • Wrap your own client:
import 'package:http_ui_logger/LoggerClient.dart';

...

final client = LoggerClient.wrap(yourClient)

//sample request
client.get('https://www.googleapis.com/books/v1/volumes?q={http}');

the client is a simple client from http library wrapped by interceptor.

Visualize

When you want to see requests made, simply push a ResponseListWidget widget with used client to the screen:

import 'package:http_ui_logger/LoggerClient.dart';
import 'package:http_ui_logger/ResponseListWidget.dart';

...

Navigator.push(
    context,
    MaterialPageRoute(builder: (context) => ResponseListWidget(client)
);

sample1 sample2

About

Flutter http inspector

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published