'Flutter : Access data from Map (key, value)
I need to access the data from key, value pair.
CashfreePGSDK.doPayment(inputParams)
.then((value) => value?.forEach((key, value) {
print("$key : $value");
//Do something with the result
}));
Currently, i am getting
I/flutter (30088): txStatus : SUCCESS
I/flutter (30088): orderAmount : 951.00
I/flutter (30088): paymentMode : CREDIT_CARD
I/flutter (30088): orderId : 61
I/flutter (30088): txTime : 2021-10-18 13:28:59
I/flutter (30088): signature : cMFtQPuqyibAN+=
I/flutter (30088): txMsg : Transaction Successful
I/flutter (30088): type : CashFreeResponse
I/flutter (30088): referenceId : 1121337
I need to keep the data in variable like i have a variable Status. So, i want to put Success in the Status. Similarly for rest of the data.
Can someone advise me on this.
Solution 1:[1]
i suspect you need it
Column(
...CashfreePGSDK.doPayment(inputParams)
.then((value) => value
.asMap().map((key, value) => MapEntry(key, Card(
title: value["title"],)))
.values.toList(
growable: true,
),
),
Solution 2:[2]
CashfreePGSDK.doPayment(inputParams).then((value) {
print(value);
print(value!['txStatus']);
var ans=value!['txStatus'];
});
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | novol |
Solution 2 |