flutterdartpayment-gatewaytap

Dart - Adding more than one parameter Type: Map<String, dynamic>


I am trying to integrate Tap payments on my Flutter mobile application.

As per Tap's documentation, I need to pass src_card for VISA/MasterCard and src_kw.knet for KNET payment gateway. The code below is only accepting one parameter.

  Map<String, dynamic> getOrderParams() {
    var cartModel = Provider.of<CartModel>(context, listen: false);
    return {
      'amount': cartModel.getTotal(),
      'currency': kAdvanceConfig.defaultCurrency?.currencyDisplay,
      'threeDSecure': true,
      'save_card': false,
      'receipt': {'email': false, 'sms': true},
      'customer': {
        'first_name': cartModel.address?.firstName ?? '',
        'last_name': cartModel.address?.lastName ?? '',
        'email': cartModel.address?.email ?? '',
      },
      'source': {'id':'src_card'},         <--- HERE
      'post': {'url': kRedirectUrl},
      'redirect': {'url': kRedirectUrl}
    };
  }

How can I pass both src_card and src_kw.knet here? I get this error when I add another param:

The literal can't be either a map or a set because it contains at least one literal map entry or a spread operator spreading a 'Map', and at least one element which is neither of these.


Solution

  • Try src_all in place of card

     'source': {'id':'src_all'}, 
    

    preview