Merge branch 'null-safe' of https://github.com/qcole/mop-flutter-sdk into qcole-null-safe
# Conflicts: # README.md # example/.flutter-plugins-dependenciesmaster
commit
12c987f760
|
@ -4,14 +4,14 @@
|
|||
</a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<p align="center">
|
||||
<strong>FinClip Flutter SDK</strong></br>
|
||||
<p>
|
||||
<p align="center">
|
||||
<p align="center">
|
||||
本项目提供在 Flutter 环境中运行小程序的能力
|
||||
<p>
|
||||
|
||||
<p align="center">
|
||||
<p align="center">
|
||||
👉 <a href="https://www.finclip.com?from=github">https://www.finclip.com/</a> 👈
|
||||
</p>
|
||||
|
||||
|
@ -166,7 +166,7 @@ class _MyAppState extends State<MyApp> {
|
|||
## 📋 接口文档
|
||||
|
||||
### 1. 初始化小程序
|
||||
|
||||
|
||||
在使用 SDK 提供的 API 之前必须要初始化 SDK ,初始化 SDK 的接口如下
|
||||
|
||||
```
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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,
|
||||
);
|
||||
|
|
50
lib/mop.dart
50
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<Map<String, dynamic>> _mopEventQueye = <Map<String, dynamic>>[];
|
||||
|
||||
Map<String, ExtensionApiHandler> _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<Map> 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<Map> 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<String, Object> 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<Map<String, dynamic>> currentApplet() async {
|
||||
final ret = await _channel.invokeMapMethod("currentApplet");
|
||||
return Map<String, dynamic>.from(ret);
|
||||
return Map<String, dynamic>.from(ret!);
|
||||
}
|
||||
|
||||
///
|
||||
|
@ -169,7 +169,7 @@ class Mop {
|
|||
Future<String> 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<String, dynamic>.from(ret);
|
||||
return Map<String, dynamic>.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<Map<String, dynamic>> list = [];
|
||||
res?.forEach((element) {
|
||||
res.forEach((element) {
|
||||
Map<String, dynamic> map = Map();
|
||||
map["menuId"] = element.menuId;
|
||||
map["image"] = element.image;
|
||||
|
@ -238,7 +238,7 @@ class Mop {
|
|||
Future<String> 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;
|
||||
}
|
||||
|
|
38
pubspec.lock
38
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"
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue