awesome_dio_interceptor 0.0.2+2 copy "awesome_dio_interceptor: ^0.0.2+2" to clipboard
awesome_dio_interceptor: ^0.0.2+2 copied to clipboard

outdated

A simple dio log interceptor (mainly inspired by the built-in dio LogInterceptor), which has coloring features and json formatting so you can have a better readable output.

example/lib/main.dart

import 'dart:io';

import 'package:awesome_dio_interceptor/awesome_dio_interceptor.dart';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Example',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Awesome Dio Interceptor'),
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);

  final String title;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(title),
      ),
      body: Center(
        child: ElevatedButton(
          onPressed: () async {
            final dio = Dio(
              BaseOptions(
                headers: {
                  HttpHeaders.contentTypeHeader: "application/json",
                  HttpHeaders.acceptHeader: "application/json"
                },
              ),
            );

            dio.interceptors.add(
              AwesomeDioInterceptor(),
            );

            await dio.get(
              'https://jsonplaceholder.typicode.com/posts/1',
            );
          },
          child: const Text('Send Request'),
        ),
      ),
    );
  }
}
54
likes
0
pub points
95%
popularity

Publisher

verified publisherdevmuaz.com

A simple dio log interceptor (mainly inspired by the built-in dio LogInterceptor), which has coloring features and json formatting so you can have a better readable output.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

colorize, dio, flutter

More

Packages that depend on awesome_dio_interceptor