methodCallHandler method

Future methodCallHandler(
  1. MethodCall call
)

Implementation

Future<dynamic> methodCallHandler(MethodCall call) async {
  switch (call.method) {
    case "mobilePaySuccess":
      final String orderId = call.arguments["orderId"];
      final completer = _orders[orderId];
      if (completer != null) {
        Map<String, dynamic> arguments =
            Map<String, dynamic>.from(call.arguments);
        completer.complete(MobilePayResult.success(arguments));
      }
      break;
    case "mobilePayFailure":
      final String orderId = call.arguments["orderId"];
      final completer = _orders[orderId];
      if (completer != null) {
        Map<String, dynamic> arguments =
            Map<String, dynamic>.from(call.arguments);
        completer.complete(MobilePayResult.failure(arguments));
      }
      break;
    case "mobilePayCancel":
      final String orderId = call.arguments["orderId"];
      final completer = _orders[orderId];
      if (completer != null) {
        Map<String, dynamic> arguments =
            Map<String, dynamic>.from(call.arguments);
        completer.complete(MobilePayResult.canceled(arguments));
      }
      break;
  }
}