PlanRequestMessage.fromMap constructor

PlanRequestMessage.fromMap(
  1. Map<String, dynamic> map
)

Implementation

factory PlanRequestMessage.fromMap(Map<String, dynamic> map) {
  if (map == null) return null;

  return PlanRequestMessage(
    name: map['name'],
    uniqueIdentifier: map['identifier'],
    cycle: map['interval'],
    intervalType: map['interval_type'],
    currencyTypeName: map['currency'],
    valueInCents: map['value_cents'],
    paymentMethod: map['payable_with'],
    prices:
        List<PlanPrice>.from(map['prices']?.map((x) => PlanPrice.fromMap(x))),
    features: List<PlanFeature>.from(
        map['features']?.map((x) => PlanFeature.fromMap(x))),
  );
}