monitor_http 1.1.0
monitor_http: ^1.1.0 copied to clipboard
HTTP client helpers for Monitor with tracking enabled by default.
Monitor HTTP #
Monitor HTTP is a tiny helper package that wraps the http client and logs
requests and responses through the monitor package automatically.
Installation #
dependencies:
monitor_http: ^0.1.0
flutter pub add monitor_http
Usage #
Initialize Monitor once at app startup:
import 'package:flutter/material.dart';
import 'package:monitor/monitor.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
Monitor.init();
runApp(const MyApp());
}
Create a tracked HTTP client:
import 'package:http/http.dart' as http;
import 'package:monitor_http/monitor_http.dart';
final http.Client client = createMonitorClient();
final response = await client.get(
Uri.parse('https://api.example.com/users'),
);
You can also wrap an existing client:
final http.Client client = MonitorHttpClient(
inner: http.Client(),
);
All requests made with the client will appear in the Monitor viewer and logs.
License #
Apache-2.0. See LICENSE for details.