instabug_dio_interceptor 2.4.0 copy "instabug_dio_interceptor: ^2.4.0" to clipboard
instabug_dio_interceptor: ^2.4.0 copied to clipboard

This package is an add on to instabug_flutter. It intercepts any requests performed with Dio Package and sends them to the report that will be sent to the dashboard.

example/lib/main.dart

import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:instabug_dio_interceptor/instabug_dio_interceptor.dart';
import 'package:instabug_flutter/instabug_flutter.dart';

Future<void> main() async {
  runApp(const MyApp());

  Instabug.init(
    token: 'ed6f659591566da19b67857e1b9d40ab',
    invocationEvents: [InvocationEvent.floatingButton],
  );

  final dio = Dio()..interceptors.add(InstabugDioInterceptor());
  final response = await dio.get('https://google.com');
  debugPrint(response.data);
}

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.headlineMedium,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ),
    );
  }
}
3
likes
150
pub points
86%
popularity

Publisher

verified publisherinstabug.com

This package is an add on to instabug_flutter. It intercepts any requests performed with Dio Package and sends them to the report that will be sent to the dashboard.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

dio, flutter, instabug_flutter

More

Packages that depend on instabug_dio_interceptor