InappifyCheckoutResult.fromMap constructor
Decodes a checkout response from JavaScript or MethodChannel.
Implementation
factory InappifyCheckoutResult.fromMap(Map<String, dynamic> map) {
final checkout = _stringMap(map['checkout']);
final nextAction = _stringMap(map['nextAction'] ?? map['next_action']);
final price = _stringMap(map['price']);
if (checkout == null) {
throw const FormatException('Checkout result requires a checkout map.');
}
return InappifyCheckoutResult(
checkout: InappifyCheckout.fromMap(checkout),
nextAction: nextAction == null
? const InappifyCheckoutNextAction(type: 'none')
: InappifyCheckoutNextAction.fromMap(nextAction),
price: price == null ? null : InappifyCheckoutPrice.fromMap(price),
);
}