dio_http_logger

Creator: coderz1093

Last updated:

0 purchases

dio_http_logger Image
dio_http_logger Images

Languages

Categories

Add to Cart

Description:

dio http logger

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
copied to clipboard
⚡Getting Started #

Add DioNetworkLogger.instance.dioNetworkInterceptor to your dio object/instances.

final client = Dio();
client.interceptors.add(DioNetworkLogger.instance.dioNetworkInterceptor!);
copied to clipboard

Set the context for internal navigation on application start or naigation start.

DioNetworkLogger.instance.context = context;
copied to clipboard

Use DioNetworkLogger.instance.overLayButtonWidget widget 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
],
),
)
);
copied to clipboard

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();
},
copied to clipboard
⚡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(
.....
);
}
copied to clipboard

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)
}
}
copied to clipboard
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.

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.