instabug_http_client 2.3.0 instabug_http_client: ^2.3.0 copied to clipboard
This package is an add on to instabug_flutter. It intercepts any requests performed with http Package and sends them to the report that will be sent to the dashboard.
import 'package:flutter/material.dart';
import 'package:instabug_http_client/instabug_http_client.dart';
import 'package:instabug_flutter/instabug_flutter.dart';
Future<void> main() async {
runApp(const MyApp());
Instabug.start(
'ed6f659591566da19b67857e1b9d40ab', [InvocationEvent.floatingButton]);
final client = InstabugHttpClient();
final response = await client.get(Uri.parse('https://google.com'));
print(response.body);
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key, required this.title}) : super(key: key);
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() {
setState(() {
_counter++;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.headline4,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: const Icon(Icons.add),
),
);
}
}