fromMap static method

Invoice? fromMap(
  1. Map<String, dynamic>? _map
)
override

Construct from Map.

Implementation

static Invoice? fromMap(Map<String, dynamic>? _map) {
  if (_map == null) return null;
  var _ = _map["@type"];
  if (_ != CONSTRUCTOR) return null;
  var extra = _map['@extra'];
  var clientId = _map['@clientId'];
  var currency = _map['currency']! as String;
  var price_parts = List<LabeledPricePart>.from(
    (_map["price_parts"] ?? []).map(
      (e) => LabeledPricePart.fromMap(e),
    ),
  );
  var max_tip_amount = _map['max_tip_amount']! as int;
  var suggested_tip_amounts = List<int>.from(
    (_map["suggested_tip_amounts"] ?? []).map(
      (e) => e as int,
    ),
  );
  var recurring_payment_terms_of_service_url =
      _map['recurring_payment_terms_of_service_url']! as String;
  var terms_of_service_url = _map['terms_of_service_url']! as String;
  var is_test = _map['is_test']! as bool;
  var need_name = _map['need_name']! as bool;
  var need_phone_number = _map['need_phone_number']! as bool;
  var need_email_address = _map['need_email_address']! as bool;
  var need_shipping_address = _map['need_shipping_address']! as bool;
  var send_phone_number_to_provider =
      _map['send_phone_number_to_provider']! as bool;
  var send_email_address_to_provider =
      _map['send_email_address_to_provider']! as bool;
  var is_flexible = _map['is_flexible']! as bool;
  return Invoice(
    extra: extra,
    clientId: clientId,
    currency: currency,
    price_parts: price_parts,
    max_tip_amount: max_tip_amount,
    suggested_tip_amounts: suggested_tip_amounts,
    recurring_payment_terms_of_service_url:
        recurring_payment_terms_of_service_url,
    terms_of_service_url: terms_of_service_url,
    is_test: is_test,
    need_name: need_name,
    need_phone_number: need_phone_number,
    need_email_address: need_email_address,
    need_shipping_address: need_shipping_address,
    send_phone_number_to_provider: send_phone_number_to_provider,
    send_email_address_to_provider: send_email_address_to_provider,
    is_flexible: is_flexible,
  );
}