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

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

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