Review.fromJson constructor

Review.fromJson(
  1. Object? json
)

Implementation

factory Review.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return Review(
    billingZip:
        map['billing_zip'] == null ? null : (map['billing_zip'] as String),
    charge: map['charge'] == null ? null : ChargeOrId.fromJson(map['charge']),
    closedReason: map['closed_reason'] == null
        ? null
        : ReviewClosedReason.fromJson(map['closed_reason']),
    created:
        DateTime.fromMillisecondsSinceEpoch((map['created'] as int).toInt()),
    id: (map['id'] as String),
    ipAddress:
        map['ip_address'] == null ? null : (map['ip_address'] as String),
    ipAddressLocation: map['ip_address_location'] == null
        ? null
        : RadarReviewResourceLocation.fromJson(map['ip_address_location']),
    livemode: (map['livemode'] as bool),
    open: (map['open'] as bool),
    openedReason: ReviewOpenedReason.fromJson(map['opened_reason']),
    paymentIntent: map['payment_intent'] == null
        ? null
        : PaymentIntentOrId.fromJson(map['payment_intent']),
    reason: (map['reason'] as String),
    session: map['session'] == null
        ? null
        : RadarReviewResourceSession.fromJson(map['session']),
  );
}