http_ui_logger 0.0.4

  • Readme
  • Changelog
  • Example
  • Installing
  • new54

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.

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

[0.0.4] - working version #

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:http_ui_logger/LoggerClient.dart';
import 'package:http/http.dart';
import 'package:http_ui_logger/ResponseListWidget.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  final client = LoggerClient.wrap(Client());

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

  runApp (
      MaterialApp (
        home: ResponseListWidget(client)
      )
  );
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  http_ui_logger: ^0.0.4

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:http_ui_logger/LoggerClient.dart';
import 'package:http_ui_logger/ResponseDataSource.dart';
import 'package:http_ui_logger/ResponseListWidget.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
13
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
54
Learn more about scoring.

We analyzed this package on Jul 14, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.15
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform Android

Because:

  • package:http_ui_logger/LoggerClient.dart that imports:
  • package:http_ui_logger/src/ResponseDataSourceImpl.dart that imports:
  • package:shared_preferences/shared_preferences.dart that imports:
  • package:shared_preferences_linux/shared_preferences_linux.dart that declares support for platforms: Linux

Package does not support Flutter platform Web

Because:

  • package:http_ui_logger/LoggerClient.dart that imports:
  • package:http_ui_logger/src/ResponseDataSourceImpl.dart that imports:
  • package:shared_preferences/shared_preferences.dart that imports:
  • package:shared_preferences_linux/shared_preferences_linux.dart that declares support for platforms: Linux

Package does not support Flutter platform Windows

Because:

  • package:http_ui_logger/LoggerClient.dart that imports:
  • package:http_ui_logger/src/ResponseDataSourceImpl.dart that imports:
  • package:shared_preferences/shared_preferences.dart that declares support for platforms: Android, iOS, Linux, macOS, Web

Package does not support Flutter platform iOS

Because:

  • package:http_ui_logger/LoggerClient.dart that imports:
  • package:http_ui_logger/src/ResponseDataSourceImpl.dart that imports:
  • package:shared_preferences/shared_preferences.dart that imports:
  • package:shared_preferences_linux/shared_preferences_linux.dart that declares support for platforms: Linux

Package does not support Flutter platform macOS

Because:

  • package:http_ui_logger/LoggerClient.dart that imports:
  • package:http_ui_logger/src/ResponseDataSourceImpl.dart that imports:
  • package:shared_preferences/shared_preferences.dart that imports:
  • package:shared_preferences_linux/shared_preferences_linux.dart that declares support for platforms: Linux

Package not compatible with SDK dart

Because:

  • http_ui_logger that is a package requiring null.

Health suggestions

Fix lib/ResponseListWidget.dart. (-0.50 points)

Analysis of lib/ResponseListWidget.dart reported 1 hint:

line 8 col 7: This class (or a class that this class inherits from) is marked as '@immutable', but one or more of its instance fields aren't final: ResponseListWidget._client

Fix lib/src/ResponseWidget.dart. (-0.50 points)

Analysis of lib/src/ResponseWidget.dart reported 1 hint:

line 8 col 7: This class (or a class that this class inherits from) is marked as '@immutable', but one or more of its instance fields aren't final: ResponseWidget._response

Format lib/LoggerClient.dart.

Run flutter format to format lib/LoggerClient.dart.

Fix additional 3 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/ResponseDataSource.dart (Run flutter format to format lib/ResponseDataSource.dart.)
  • lib/src/LoggableResponse.dart (Run flutter format to format lib/src/LoggableResponse.dart.)
  • lib/src/ResponseDataSourceImpl.dart (Run flutter format to format lib/src/ResponseDataSourceImpl.dart.)

Maintenance suggestions

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
flutter 0.0.0
http >=0.12.0 <1.0.0 0.12.1
shared_preferences >=0.5.0 <1.0.0 0.5.8
Transitive dependencies
charcode 1.1.3
collection 1.14.12 1.14.13
file 5.2.1
flutter_web_plugins 0.0.0
http_parser 3.1.4
intl 0.16.1
meta 1.1.8 1.2.2
path 1.7.0
path_provider_linux 0.0.1+2
path_provider_platform_interface 1.0.2
pedantic 1.9.0 1.9.2
platform 2.2.1
plugin_platform_interface 1.0.2
process 3.0.13
shared_preferences_linux 0.0.2+1
shared_preferences_macos 0.0.1+10
shared_preferences_platform_interface 1.0.4
shared_preferences_web 0.1.2+7
sky_engine 0.0.99
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
xdg_directories 0.1.0
Dev dependencies
flutter_test