import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';

class Jdsdk {
  static const MethodChannel _channel = const MethodChannel('jdsdk');

  ///
  /// 初始化京东sdk
  /// [appKey]        appKey
  /// [appSecret]     app密钥
  ///
  static Future<String> init(
      {@required String appKey, @required String appSecret}) async {
    final String version = await _channel
        .invokeMethod('init', {"appKey": appKey, "appSecret": appSecret});
    return version;
  }

  ///
  /// 打开京东的任意URL
  /// [url]             待打开的url地址
  ///
  static Future<String> openUrl({@required String url}) async {
    final String version = await _channel.invokeMethod('openUrl', {"url": url});
    return version;
  }
}
