Browse Source

1.增加方法调用SDK能力

tags/0.0.2
“yanghuaxuan” 3 years ago
parent
commit
69bcfd7f9f
2 changed files with 47 additions and 0 deletions
  1. +43
    -0
      lib/register.dart
  2. +4
    -0
      pubspec.yaml

+ 43
- 0
lib/register.dart View File

@@ -0,0 +1,43 @@
import 'dart:io';

import 'package:zhiying_comm/util/application.dart';

import 'jdsdk.dart';

class FlutterJDSDKRegister {
static init() {
initMethod();
}

static void initMethod() {
////初始化JDSDK
Application.addStringParamsMethod(
type: "init_jd_sdk",
method: (param, callback) async {
if (param == null) {
print("jd初始化参数为空");
return;
}
var result = await Jdsdk.init(appKey: param['appKey'] ?? '', appSecret: param['appSecret'] ?? '');
print(result);
if (callback != null) {
callback(result);
}
});

////打开京东appUrl
Application.addStringParamsMethod(
type: "open_jd_url",
method: (param, callback) async {
if (param == null) {
print("jd初始化参数为空");
return;
}
var result = await Jdsdk.openUrl(url: param['url'] ?? '');
print(result);
if (callback != null) {
callback(result);
}
});
}
}

+ 4
- 0
pubspec.yaml View File

@@ -11,9 +11,13 @@ dependencies:
flutter:
sdk: flutter



dev_dependencies:
flutter_test:
sdk: flutter
zhiying_comm:
path: ../zhiying_comm

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec


Loading…
Cancel
Save