如何从颤振中的变量中检索值?

How to retrieve values from variable in flutter?

我正在学习使用 brain tree 在 flutter 中访问支付的教程。

这是教程中描述的方法。

payNow() async {
    BraintreePayment braintreePayment = new BraintreePayment();
    var data = await braintreePayment.showDropIn(
        nonce: clientNonce, amount: amount, enableGooglePay: true, nameRequired:true);

    print("Response of the payment $data");


  } 

在打印 var 数据时我收到了这个。

{message: Payment Nouce is ready., status: success, paymentNonce: tokencc_xxxxxxxxxxxxx}

我想从中检索 paymentNonce 值,即 "tokencc_xxxxxxxxxxxxx"

如果我能在模型中获取值就更好了 class。

使用数据["paymentNonce"]得到你想要的,因为它是JSON(键值对)