diff --git a/README.md b/README.md index 754c9d5..2aa614c 100644 --- a/README.md +++ b/README.md @@ -4,14 +4,14 @@

-

+

FinClip Flutter SDK

-

+

本项目提供在 Flutter 环境中运行小程序的能力

-

+

👉 https://www.finclip.com/ 👈

@@ -166,7 +166,7 @@ class _MyAppState extends State { ## 📋 接口文档 ### 1. 初始化小程序 - + 在使用 SDK 提供的 API 之前必须要初始化 SDK ,初始化 SDK 的接口如下 ``` diff --git a/example/pubspec.lock b/example/pubspec.lock index e9626a4..52f1eff 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -5,56 +5,56 @@ packages: dependency: transitive description: name: async - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.6.1" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" characters: dependency: transitive description: name: characters - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.1.0" charcode: dependency: transitive description: name: charcode - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.2.0" clock: dependency: transitive description: name: clock - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.1.0" collection: dependency: transitive description: name: collection - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.15.0" cupertino_icons: dependency: "direct main" description: name: cupertino_icons - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.1.3" fake_async: dependency: transitive description: name: fake_async - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.2.0" flutter: @@ -71,14 +71,14 @@ packages: dependency: transitive description: name: matcher - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.12.10" meta: dependency: transitive description: name: meta - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.3.0" mop: @@ -92,7 +92,7 @@ packages: dependency: transitive description: name: path - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.8.0" sky_engine: @@ -104,58 +104,58 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.8.1" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.2.0" test_api: dependency: transitive description: name: test_api - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.3.0" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.3.0" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" sdks: dart: ">=2.12.0 <3.0.0" - flutter: ">=1.10.0" + flutter: ">=2.2.3" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index bd40a2d..ce89754 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -3,7 +3,7 @@ description: Demonstrates how to use the mop plugin. publish_to: 'none' environment: - sdk: '>=2.1.0 <3.0.0' + sdk: '>=2.12.0 <3.0.0' dependencies: flutter: diff --git a/example/test/widget_test.dart b/example/test/widget_test.dart index 9808a6f..bf7d60e 100644 --- a/example/test/widget_test.dart +++ b/example/test/widget_test.dart @@ -19,7 +19,7 @@ void main() { expect( find.byWidgetPredicate( (Widget widget) => widget is Text && - widget.data.startsWith('Running on:'), + widget.data!.startsWith('Running on:'), ), findsOneWidget, ); diff --git a/lib/mop.dart b/lib/mop.dart index 855078e..aa99518 100644 --- a/lib/mop.dart +++ b/lib/mop.dart @@ -10,9 +10,9 @@ typedef ExtensionApiHandler = Future Function(dynamic params); class Mop { static final Mop _instance = new Mop._internal(); - MethodChannel _channel; - EventChannel _mopEventChannel; - int eventId = 0; + late MethodChannel _channel; + late EventChannel _mopEventChannel; + late int eventId = 0; List> _mopEventQueye = >[]; Map _extensionApis = {}; @@ -21,7 +21,7 @@ class Mop { return _instance; } - Mop._internal() { + Mop._internal() { print('mop: _internal'); // init _channel = new MethodChannel('mop'); @@ -71,11 +71,11 @@ class Mop { /// [disablePermission] is optional. /// Future initialize(String appkey, String secret, - {String apiServer, - String apiPrefix, - String cryptType, - bool disablePermission, - String userId, + { String? apiServer, + String? apiPrefix, + String? cryptType, + bool? disablePermission, + String? userId, bool encryptServerData = false, bool debug = false, bool bindAppletWithMainProcess = false}) async { @@ -106,19 +106,19 @@ class Mop { /// [cryptType] is optional. cryptType, should be MD5/SM Future openApplet( final String appId, { - final String path, - final String query, - final int sequence, - final String apiServer, - final String apiPrefix, - final String fingerprint, - final String cryptType, - final String scene, + final String? path, + final String? query, + final int? sequence, + final String? apiServer, + final String? apiPrefix, + final String? fingerprint, + final String? cryptType, + final String? scene, }) async { Map params = {'appId': appId}; Map param = {}; - if (path != null) param["path"] = path; - if (query != null) param["query"] = query; + param["path"] = path; + param["query"] = query; if (param.length > 0) params["params"] = param; if (sequence != null) params["sequence"] = sequence; if (apiServer != null) params["apiServer"] = apiServer; @@ -138,7 +138,7 @@ class Mop { /// Future> currentApplet() async { final ret = await _channel.invokeMapMethod("currentApplet"); - return Map.from(ret); + return Map.from(ret!); } /// @@ -169,7 +169,7 @@ class Mop { Future sdkVersion() async { return await _channel .invokeMapMethod("sdkVersion") - .then((value) => value["data"]); + .then((value) => value?["data"]); } /// @@ -187,7 +187,7 @@ class Mop { String qrCode, String apiServer) async { final ret = await _channel.invokeMapMethod("parseAppletInfoFromWXQrCode", {"qrCode": qrCode, "apiServer": apiServer}); - return Map.from(ret); + return Map.from(ret!); } /// @@ -202,9 +202,9 @@ class Mop { return handler.getUserInfo(); }; _extensionApis["getCustomMenus"] = (params) async { - final res = await handler.getCustomMenus(params["appId"]); + final res = await handler.getCustomMenus(params["appId"]); List> list = []; - res?.forEach((element) { + res.forEach((element) { Map map = Map(); map["menuId"] = element.menuId; map["image"] = element.image; @@ -238,7 +238,7 @@ class Mop { Future getSMSign(String plainText) async { var result = await _channel.invokeMapMethod("smsign", {'plainText': plainText}); - var data = result['data']['data']; + var data = result?['data']['data']; print(data); return data; } diff --git a/pubspec.lock b/pubspec.lock index 65b1ee6..98ff506 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,49 +5,49 @@ packages: dependency: transitive description: name: async - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.6.1" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" characters: dependency: transitive description: name: characters - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.1.0" charcode: dependency: transitive description: name: charcode - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.2.0" clock: dependency: transitive description: name: clock - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.1.0" collection: dependency: transitive description: name: collection - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.15.0" fake_async: dependency: transitive description: name: fake_async - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.2.0" flutter: @@ -64,21 +64,21 @@ packages: dependency: transitive description: name: matcher - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.12.10" meta: dependency: transitive description: name: meta - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.3.0" path: dependency: transitive description: name: path - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.8.0" sky_engine: @@ -90,58 +90,58 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.8.1" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.2.0" test_api: dependency: transitive description: name: test_api - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.3.0" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.3.0" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" sdks: dart: ">=2.12.0 <3.0.0" - flutter: ">=1.10.0" + flutter: ">=2.2.3" diff --git a/pubspec.yaml b/pubspec.yaml index d95f43c..1f0aa0f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,8 +4,8 @@ version: '2.34.3' homepage: https://github.com/finogeeks/mop-flutter-sdk environment: - sdk: '>=2.1.0 <3.0.0' - flutter: '^1.10.0' + sdk: '>=2.12.0 <3.0.0' + flutter: '^2.2.3' dependencies: flutter: