diff --git a/.vscode/launch.json b/.vscode/launch.json index 4631d3a..0c89af4 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -6,7 +6,7 @@ "configurations": [ { "name": "Flutter", - "program": "lib/main.dart", + "program": "example/lib/main.dart", "request": "launch", "type": "dart" } diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock new file mode 100644 index 0000000..9e27c9c --- /dev/null +++ b/example/ios/Podfile.lock @@ -0,0 +1,103 @@ +PODS: + - device_info (0.0.1): + - Flutter + - Flutter (1.0.0) + - flutter_native_image (0.0.1): + - Flutter + - fluttertoast (0.0.2): + - Flutter + - FMDB (2.7.5): + - FMDB/standard (= 2.7.5) + - FMDB/standard (2.7.5) + - package_info (0.0.1): + - Flutter + - path_provider (0.0.1): + - Flutter + - path_provider_linux (0.0.1): + - Flutter + - path_provider_macos (0.0.1): + - Flutter + - shared_preferences (0.0.1): + - Flutter + - shared_preferences_linux (0.0.1): + - Flutter + - shared_preferences_macos (0.0.1): + - Flutter + - shared_preferences_web (0.0.1): + - Flutter + - sqflite (0.0.1): + - Flutter + - FMDB (~> 2.7.2) + - zhiying_comm (0.0.1): + - Flutter + +DEPENDENCIES: + - device_info (from `.symlinks/plugins/device_info/ios`) + - Flutter (from `Flutter`) + - flutter_native_image (from `.symlinks/plugins/flutter_native_image/ios`) + - fluttertoast (from `.symlinks/plugins/fluttertoast/ios`) + - package_info (from `.symlinks/plugins/package_info/ios`) + - path_provider (from `.symlinks/plugins/path_provider/ios`) + - path_provider_linux (from `.symlinks/plugins/path_provider_linux/ios`) + - path_provider_macos (from `.symlinks/plugins/path_provider_macos/ios`) + - shared_preferences (from `.symlinks/plugins/shared_preferences/ios`) + - shared_preferences_linux (from `.symlinks/plugins/shared_preferences_linux/ios`) + - shared_preferences_macos (from `.symlinks/plugins/shared_preferences_macos/ios`) + - shared_preferences_web (from `.symlinks/plugins/shared_preferences_web/ios`) + - sqflite (from `.symlinks/plugins/sqflite/ios`) + - zhiying_comm (from `.symlinks/plugins/zhiying_comm/ios`) + +SPEC REPOS: + trunk: + - FMDB + +EXTERNAL SOURCES: + device_info: + :path: ".symlinks/plugins/device_info/ios" + Flutter: + :path: Flutter + flutter_native_image: + :path: ".symlinks/plugins/flutter_native_image/ios" + fluttertoast: + :path: ".symlinks/plugins/fluttertoast/ios" + package_info: + :path: ".symlinks/plugins/package_info/ios" + path_provider: + :path: ".symlinks/plugins/path_provider/ios" + path_provider_linux: + :path: ".symlinks/plugins/path_provider_linux/ios" + path_provider_macos: + :path: ".symlinks/plugins/path_provider_macos/ios" + shared_preferences: + :path: ".symlinks/plugins/shared_preferences/ios" + shared_preferences_linux: + :path: ".symlinks/plugins/shared_preferences_linux/ios" + shared_preferences_macos: + :path: ".symlinks/plugins/shared_preferences_macos/ios" + shared_preferences_web: + :path: ".symlinks/plugins/shared_preferences_web/ios" + sqflite: + :path: ".symlinks/plugins/sqflite/ios" + zhiying_comm: + :path: ".symlinks/plugins/zhiying_comm/ios" + +SPEC CHECKSUMS: + device_info: d7d233b645a32c40dfdc212de5cf646ca482f175 + Flutter: 0e3d915762c693b495b44d77113d4970485de6ec + flutter_native_image: 9c0b7451838484458e5b0fae007b86a4c2d4bdfe + fluttertoast: b644586ef3b16f67fae9a1f8754cef6b2d6b634b + FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a + package_info: 873975fc26034f0b863a300ad47e7f1ac6c7ec62 + path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c + path_provider_linux: 4d630dc393e1f20364f3e3b4a2ff41d9674a84e4 + path_provider_macos: f760a3c5b04357c380e2fddb6f9db6f3015897e0 + shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d + shared_preferences_linux: afefbfe8d921e207f01ede8b60373d9e3b566b78 + shared_preferences_macos: f3f29b71ccbb56bf40c9dd6396c9acf15e214087 + shared_preferences_web: 141cce0c3ed1a1c5bf2a0e44f52d31eeb66e5ea9 + sqflite: 4001a31ff81d210346b500c55b17f4d6c7589dd0 + zhiying_comm: 0daef4a480f4f4dbea3e11b615f3264aafea924b + +PODFILE CHECKSUM: 3dbe063e9c90a5d7c9e4e76e70a821b9e2c1d271 + +COCOAPODS: 1.9.3 diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index 1bf9951..d581101 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -11,6 +11,7 @@ 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 8392C03FA6C72CAB4F5C4CC3 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6A1B7C2B50097C8170B71A96 /* libPods-Runner.a */; }; 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; @@ -38,11 +39,14 @@ /* Begin PBXFileReference section */ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 3AE46CA1A9766F14895E9A3C /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; + 6A1B7C2B50097C8170B71A96 /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + 81DAE47BE752C6766DCC2F7E /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; @@ -52,6 +56,7 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + F1628CBC8D15F3FA852FDD72 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -61,12 +66,24 @@ files = ( 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, + 8392C03FA6C72CAB4F5C4CC3 /* libPods-Runner.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 797CB0D7220BB44A3506E52E /* Pods */ = { + isa = PBXGroup; + children = ( + 3AE46CA1A9766F14895E9A3C /* Pods-Runner.debug.xcconfig */, + 81DAE47BE752C6766DCC2F7E /* Pods-Runner.release.xcconfig */, + F1628CBC8D15F3FA852FDD72 /* Pods-Runner.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( @@ -86,7 +103,8 @@ 9740EEB11CF90186004384FC /* Flutter */, 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, - CF3B75C9A7D2FA2A4C99F110 /* Frameworks */, + 797CB0D7220BB44A3506E52E /* Pods */, + C515045CAD881A02B77DBC01 /* Frameworks */, ); sourceTree = ""; }; @@ -122,6 +140,14 @@ name = "Supporting Files"; sourceTree = ""; }; + C515045CAD881A02B77DBC01 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 6A1B7C2B50097C8170B71A96 /* libPods-Runner.a */, + ); + name = Frameworks; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -129,12 +155,14 @@ isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( + FC27367DF1001F558C953AB1 /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + 59F5B2BD0CC9263415C8DC83 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -206,6 +234,21 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; }; + 59F5B2BD0CC9263415C8DC83 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Embed Pods Frameworks"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -220,6 +263,28 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; + FC27367DF1001F558C953AB1 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ diff --git a/example/ios/Runner.xcworkspace/contents.xcworkspacedata b/example/ios/Runner.xcworkspace/contents.xcworkspacedata index 1d526a1..21a3cc1 100644 --- a/example/ios/Runner.xcworkspace/contents.xcworkspacedata +++ b/example/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -4,4 +4,7 @@ + + diff --git a/example/ios/Runner/AppDelegate.m b/example/ios/Runner/AppDelegate.m index 70e8393..9503af2 100644 --- a/example/ios/Runner/AppDelegate.m +++ b/example/ios/Runner/AppDelegate.m @@ -1,13 +1,34 @@ #import "AppDelegate.h" #import "GeneratedPluginRegistrant.h" +#import @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + [ZhiyingCommNative regist: self]; [GeneratedPluginRegistrant registerWithRegistry:self]; - // Override point for customization after application launch. return [super application:application didFinishLaunchingWithOptions:launchOptions]; } +// 公共跳转方法 +- (void)openPage: (NSDictionary*)params { + +} + +- (void)openNativePage: (NSDictionary*)params { + NSString *method = [params valueForKey:@"method"]; + if ([method isEqualToString: @""]) { + } +} + + +// 获取设置 +- (NSDictionary*)getSetting { + return @{ + // @"domain": @"http://120.76.175.204:8989" + @"domain": @"http://192.168.0.113:5000" + }; +} + @end diff --git a/example/lib/main.dart b/example/lib/main.dart index dd6a537..947a402 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -36,6 +36,19 @@ class _MyAppState extends State { }); }, child: Text('登录请求'), + ), + RaisedButton( + onPressed: () { + NetUtil.request('/api/v1/rec/featured?page=1', + method: NetMethod.GET, params: {}); + }, + child: Text('页面请求'), + ), + RaisedButton( + onPressed: () { + NetUtil.request('/api/v1/config.json', params: {}); + }, + child: Text('基础配置'), ) ], )), diff --git a/example/pubspec.lock b/example/pubspec.lock index 6e86315..3e3e662 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -125,6 +125,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "0.0.5+2" + flutter_screenutil: + dependency: transitive + description: + name: flutter_screenutil + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.1.0" flutter_test: dependency: "direct dev" description: flutter @@ -275,6 +282,41 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "0.24.1" + shared_preferences: + dependency: transitive + description: + name: shared_preferences + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.5.10" + shared_preferences_linux: + dependency: transitive + description: + name: shared_preferences_linux + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.0.2+2" + shared_preferences_macos: + dependency: transitive + description: + name: shared_preferences_macos + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.0.1+10" + shared_preferences_platform_interface: + dependency: transitive + description: + name: shared_preferences_platform_interface + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.4" + shared_preferences_web: + dependency: transitive + description: + name: shared_preferences_web + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.1.2+7" sky_engine: dependency: transitive description: flutter diff --git a/ios/Classes/ZhiyingCommPlugin.m b/ios/Classes/ZhiyingCommPlugin.m index 27fc806..c402725 100644 --- a/ios/Classes/ZhiyingCommPlugin.m +++ b/ios/Classes/ZhiyingCommPlugin.m @@ -1,20 +1,10 @@ #import "ZhiyingCommPlugin.h" +#import "ZhiyingCommNative.h" @implementation ZhiyingCommPlugin + (void)registerWithRegistrar:(NSObject*)registrar { - FlutterMethodChannel* channel = [FlutterMethodChannel - methodChannelWithName:@"zhiying_comm" - binaryMessenger:[registrar messenger]]; - ZhiyingCommPlugin* instance = [[ZhiyingCommPlugin alloc] init]; - [registrar addMethodCallDelegate:instance channel:channel]; + [ZhiyingCommNative registerWithRegistrar:registrar]; } -- (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result { - if ([@"getPlatformVersion" isEqualToString:call.method]) { - result([@"iOS " stringByAppendingString:[[UIDevice currentDevice] systemVersion]]); - } else { - result(FlutterMethodNotImplemented); - } -} @end diff --git a/lib/util/net_util.dart b/lib/util/net_util.dart index 563cecc..a02b533 100644 --- a/lib/util/net_util.dart +++ b/lib/util/net_util.dart @@ -17,6 +17,17 @@ typedef OnSuccess = dynamic Function(dynamic data); typedef OnError = dynamic Function(String e); typedef OnCache = dynamic Function(dynamic data); +enum NetMethod { + GET, + POST, + PUT, + DELETE, + OPTIONS, + PATCH, + UPDATE, + HEAD, +} + class NetUtil { Dio _dio; @@ -35,7 +46,7 @@ class NetUtil { if (_dio == null) { var setting = await NativeUtil.getSetting(); String domain = setting['domain']; //'http://www.hairuyi.com/'; - _config(domain); + _config(domain, proxyUrl: '192.168.0.112:8888'); } return _dio; } @@ -44,12 +55,14 @@ class NetUtil { /// apiVersion 接口版本 void _config(String baseUrl, {String proxyUrl}) { _dio = Dio(BaseOptions( - method: "post", - baseUrl: baseUrl, - connectTimeout: 15000, - receiveTimeout: 15000, - contentType: Headers.jsonContentType, - followRedirects: true)); + method: "post", + baseUrl: baseUrl, + connectTimeout: 15000, + receiveTimeout: 15000, + contentType: Headers.jsonContentType, + followRedirects: true, + headers: {'device': 'wx_applet'}, + )); _dio.interceptors.add(_NetInterceptors()); _dio.interceptors.add(LogInterceptor()); @@ -107,7 +120,6 @@ class NetUtil { GlobalConfig.RESPONSE_SUCCESS_CODE || result[GlobalConfig.HTTP_RESPONSE_KEY_CODE] == '${GlobalConfig.RESPONSE_SUCCESS_CODE}') { - Logger.error(result[GlobalConfig.HTTP_RESPONSE_KEY_MSG]); Fluttertoast.showToast( @@ -121,7 +133,7 @@ class NetUtil { /// 异步请求 static void request(String path, - {String method = 'POST', + {NetMethod method = NetMethod.GET, Map params, Map multiFiles, OnSuccess onSuccess, @@ -141,16 +153,8 @@ class NetUtil { Response response; try { Dio dio = await NetUtil.getInstance().dio; - // 文件 - if (multiFiles != null && multiFiles.length > 0) { - for (String key in multiFiles.keys) { - var file = await MultipartFile.fromFile(multiFiles[key].path); - sign[key] = file; - } - } - FormData formData = FormData.fromMap(sign); - response = await dio.request(path, - data: formData, options: Options(method: method)); + dio.request(path, + data: sign, options: Options(method: enumToString(method))); } on DioError catch (e) { _formatError(e); } @@ -172,7 +176,7 @@ class NetUtil { } return; } - + Logger.error('error: ' + result[GlobalConfig.HTTP_RESPONSE_KEY_MSG]); Fluttertoast.showToast( msg: result[GlobalConfig.HTTP_RESPONSE_KEY_MSG], @@ -264,9 +268,11 @@ class NetUtil { } /// 获取请求缓存成功的数据 - static Future _onCallBackCacheData(OnCache onCache, String cacheKey) async { + static Future _onCallBackCacheData( + OnCache onCache, String cacheKey) async { // 读取缓存 - Map cacheMap = await SharedPreferencesUtil.getNetCacheResult(cacheKey); + Map cacheMap = + await SharedPreferencesUtil.getNetCacheResult(cacheKey); if (!EmptyUtil.isEmpty(cacheMap) && cacheMap.containsKey(GlobalConfig.RESPONSE_SUCCESS_CODE) && (cacheMap[GlobalConfig.RESPONSE_SUCCESS_CODE] == @@ -342,7 +348,8 @@ class _NetInterceptors extends InterceptorsWrapper { @override Future onResponse(Response response) { - Logger.endNet(response.realUri.toString(), data: response?.data?.toString() ?? ''); + Logger.endNet(response?.statusCode?.toString(), + data: response?.data?.toString() ?? ''); // TODO 解密? return super.onResponse(response); } diff --git a/pubspec.lock b/pubspec.lock index 67d39b4..3eef23b 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -118,6 +118,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "0.0.5+2" + flutter_screenutil: + dependency: "direct main" + description: + name: flutter_screenutil + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.1.0" flutter_test: dependency: "direct dev" description: flutter @@ -268,6 +275,41 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "0.24.1" + shared_preferences: + dependency: "direct main" + description: + name: shared_preferences + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.5.10" + shared_preferences_linux: + dependency: transitive + description: + name: shared_preferences_linux + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.0.2+2" + shared_preferences_macos: + dependency: transitive + description: + name: shared_preferences_macos + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.0.1+10" + shared_preferences_platform_interface: + dependency: transitive + description: + name: shared_preferences_platform_interface + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.4" + shared_preferences_web: + dependency: transitive + description: + name: shared_preferences_web + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.1.2+7" sky_engine: dependency: transitive description: flutter