dio_http_logger 1.0.3
dio_http_logger: ^1.0.3 copied to clipboard
Dio network logger library for viewing request, response and error logs for any requests
dio_http_logger #
A powerful network interceptor for Dio, providing comprehensive logging of requests, responses and errors.
⚡ Screenshots #
![]() |
![]() |
![]() |
![]() |
![]() |
|---|
⚡Features #
- Detailed Logging: Log request method, URL, headers, query parameters, request body, response status code, headers, request time, response time, request data size, response data size and response body.
- Error stack-trace: Stack trace data directly from Dio in error requests.
- Easy Integration: Add the interceptor to your Dio instance with just a few lines of code.
⚡Installation #
Add dio_http_logger to your pubspec.yaml file:
dio: ">=4.0.0 <6.0.0" //use the latest version, 5.6.0 was my latest, old version user DioError instead of DioException.
.....
dio_http_logger: ^latest_version
⚡Getting Started #
- Add
DioNetworkLogger.instance.dioNetworkInterceptorto your dio object/instances.
final client = Dio();
client.interceptors.add(DioNetworkLogger.instance.dioNetworkInterceptor!);
- Set the context for internal navigation on application start or naigation start.
DioNetworkLogger.instance.context = context;
- Use
DioNetworkLogger.instance.overLayButtonWidgetwidget to direct navigate to the library (Use it at the root view of your application, this will make the button appear in every screen).
runApp(
MaterialApp(
home: Stack(
children: [
const MyApp(),
DioNetworkLogger.instance.overLayButtonWidget
],
),
)
);
- Or you can use
DioNetworkLogger.instance.startNetworkLoggerScreen()to direct navigate to the library
//Use it on any callback
onPressed: () {
DioNetworkLogger.instance.context = context;
DioNetworkLogger.instance.startNetworkLoggerScreen();
},
⚡Push notification (Optional) #
This is an optional feature. If you want to get local push notification when the network request is triggered or any response comes from the server.
![]() |
![]() |
|---|
- Initialize the notification.
void main() async{
....
WidgetsFlutterBinding.ensureInitialized();;
await DioNetworkLogger.instance.initLocalNotifications();
runApp(
.....
);
}
- For ios configure your AppDelegate
//other imports
import flutter_local_notifications
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
FlutterLocalNotificationsPlugin.setPluginRegistrantCallback { (registry) in
GeneratedPluginRegistrant.register(with: registry)}
GeneratedPluginRegistrant.register(with: self)
if #available(iOS 10.0, *) {
UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate
}
return super.application(application,didFinishLaunchingWithOptions:launchOptions)
}
}
NOTE: Used the flutter_local_notifications: ^17.2.2 plugin. If you find any issues, try to follow the documentation of flutter_local_notifications and dont forget to throw an issue in github.






