webase_chucker 0.1.4
webase_chucker: ^0.1.4 copied to clipboard
In-app HTTP inspector for Dio. One line to integrate: a floating button, a live status notification, request/response/cURL viewer — no setup needed.
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:webase_chucker/webase_chucker.dart';
final dio = Dio()
..interceptors.add(WebaseChucker.interceptor); // the only line needed
void main() => runApp(const ExampleApp());
class ExampleApp extends StatelessWidget {
const ExampleApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'webase_chucker example',
debugShowCheckedModeBanner: false,
home: Scaffold(
appBar: AppBar(title: const Text('webase_chucker example')),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
FilledButton(
onPressed: () =>
dio.get('https://jsonplaceholder.typicode.com/todos/1'),
child: const Text('GET (200)'),
),
const SizedBox(height: 12),
FilledButton(
onPressed: () => dio.post(
'https://jsonplaceholder.typicode.com/posts',
data: {'title': 'hello', 'body': 'world'},
),
child: const Text('POST (201)'),
),
const SizedBox(height: 12),
FilledButton(
onPressed: () =>
dio.get('https://jsonplaceholder.typicode.com/nope'),
child: const Text('GET (404)'),
),
const SizedBox(height: 12),
OutlinedButton(
onPressed: WebaseChucker.open,
child: const Text('Open inspector'),
),
],
),
),
),
);
}
}