MethodChannelDy constructor

MethodChannelDy()

Implementation

MethodChannelDy() {
  methodChannel.setMethodCallHandler((call) async {
    debugPrint("${call.method}---${call.arguments}");
    String method = call.method;
    switch (method) {
      case "getAccessToken":
        dynamic arguments = call.arguments;
        if (arguments != null) {
          debugPrint("arguments is $arguments");
          try {
            debugPrint("arguments is ${arguments["code"] == "200"}");
            if (arguments["code"] == 200) {
              debugPrint("arguments is ${arguments["code"] == "200"}");

              _callBackListener?.call("getAuthCode", arguments);
            }
          } on Exception catch (e) {
            debugPrint("error is $e");
          }
        }
        return Future.value(true);
      case "getSharePageResult":
        dynamic arguments = call.arguments;
        _callBackListener?.call("getSharePageResult", arguments);
        return Future.value(true);
      default:
        return Future.value(true);
    }
  });
}