From 3e66fae537f07725fb52800ff1b2a35b9dd4e51e Mon Sep 17 00:00:00 2001 From: Fleeming Date: Mon, 8 May 2023 15:04:57 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81update=20dio=205.0.0=202=E3=80=81fix?= =?UTF-8?q?=20DioLogInterceptor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1、update dio 5.0.0 2、fix DioLogInterceptor --- .dart_tool/version | 2 +- android/local.properties | 2 ++ lib/interceptor/dio_log_interceptor.dart | 18 ++++++++++-------- pubspec.yaml | 2 +- 4 files changed, 14 insertions(+), 10 deletions(-) create mode 100644 android/local.properties diff --git a/.dart_tool/version b/.dart_tool/version index 13d683c..b44c537 100644 --- a/.dart_tool/version +++ b/.dart_tool/version @@ -1 +1 @@ -3.0.1 \ No newline at end of file +3.7.12 \ No newline at end of file diff --git a/android/local.properties b/android/local.properties new file mode 100644 index 0000000..7cc4608 --- /dev/null +++ b/android/local.properties @@ -0,0 +1,2 @@ +sdk.dir=/Users/mingo/Library/Android/sdk +flutter.sdk=/Users/mingo/Downloads/flutter \ No newline at end of file diff --git a/lib/interceptor/dio_log_interceptor.dart b/lib/interceptor/dio_log_interceptor.dart index 1e1c230..998e6fe 100644 --- a/lib/interceptor/dio_log_interceptor.dart +++ b/lib/interceptor/dio_log_interceptor.dart @@ -3,6 +3,8 @@ import 'package:dio_log/bean/err_options.dart'; import 'package:dio_log/bean/net_options.dart'; import 'package:dio_log/bean/req_options.dart'; import 'package:dio_log/bean/res_options.dart'; +// import 'package:flutter/material.dart' show debugPrint; +import 'dart:developer'; import '../dio_log.dart'; @@ -62,14 +64,14 @@ class DioLogInterceptor implements Interceptor { resOpt.headers = response.headers.map; logManage?.onResponse(resOpt); if (enablePrintLog) { - NetOptions log = - LogPoolManager.getInstance().logMap[resOpt.id.toString()]!; - print('dio_log: request: url:${log.reqOptions?.url}'); - print('dio_log: request: method:${log.reqOptions?.method}'); - print('dio_log: request: params:${log.reqOptions?.params}'); - print( - 'dio_log: request: duration:${getTimeStr1(log.reqOptions!.requestTime!)}'); - print('dio_log: response: ${toJson(log.resOptions?.data)}'); + NetOptions opt = LogPoolManager.getInstance().logMap[resOpt.id.toString()]!; + log('dio_log_request: duration:${getTimeStr1(opt.reqOptions!.requestTime!)}'); + log('dio_log_request: url:${opt.reqOptions?.url}'); + log('dio_log_request: method:${opt.reqOptions?.method}'); + log('dio_log_request: headers:${opt.reqOptions?.headers}'); + log('dio_log_request: params:${opt.reqOptions?.params}'); + log('dio_log_request: data:${opt.reqOptions?.data}'); + log('dio_log_response: ${toJson(opt.resOptions?.data)}'); } } } diff --git a/pubspec.yaml b/pubspec.yaml index 7ea3068..0fa89d4 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -9,7 +9,7 @@ environment: dependencies: flutter: sdk: flutter - dio: ^4.0.0 + dio: any dev_dependencies: flutter_test: