flutter京东SDK插件
 
 
 
 
 

44 linhas
1.1 KiB

  1. import 'dart:io';
  2. import 'package:zhiying_comm/util/application.dart';
  3. import 'jdsdk.dart';
  4. class FlutterJDSDKRegister {
  5. static init() {
  6. initMethod();
  7. }
  8. static void initMethod() {
  9. ////初始化JDSDK
  10. Application.addStringParamsMethod(
  11. type: "init_jd_sdk",
  12. method: (param, callback) async {
  13. if (param == null) {
  14. print("jd初始化参数为空");
  15. return;
  16. }
  17. var result = await Jdsdk.init(appKey: param['appKey'] ?? '', appSecret: param['appSecret'] ?? '');
  18. print(result);
  19. if (callback != null) {
  20. callback(result);
  21. }
  22. });
  23. ////打开京东appUrl
  24. Application.addStringParamsMethod(
  25. type: "open_jd_url",
  26. method: (param, callback) async {
  27. if (param == null) {
  28. print("jd初始化参数为空");
  29. return;
  30. }
  31. var result = await Jdsdk.openUrl(url: param['url'] ?? '');
  32. print(result);
  33. if (callback != null) {
  34. callback(result);
  35. }
  36. });
  37. }
  38. }