fromMap static method

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

Construct from Map.

Implementation

static PaymentForm? 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 id = _map['id']! as int64;
  var invoice = Invoice.fromMap(_map['invoice'])!;
  var seller_bot_user_id = _map['seller_bot_user_id']! as int;
  var payment_provider_user_id = _map['payment_provider_user_id']! as int;
  var payment_provider = PaymentProvider.fromMap(_map['payment_provider'])!;
  var additional_payment_options = List<PaymentOption>.from(
    (_map["additional_payment_options"] ?? []).map(
      (e) => PaymentOption.fromMap(e),
    ),
  );
  var saved_order_info = OrderInfo.fromMap(_map['saved_order_info']);
  var saved_credentials = List<SavedCredentials>.from(
    (_map["saved_credentials"] ?? []).map(
      (e) => SavedCredentials.fromMap(e),
    ),
  );
  var can_save_credentials = _map['can_save_credentials']! as bool;
  var need_password = _map['need_password']! as bool;
  var product_title = _map['product_title']! as String;
  var product_description =
      FormattedText.fromMap(_map['product_description'])!;
  var product_photo = Photo.fromMap(_map['product_photo']);
  return PaymentForm(
    extra: extra,
    clientId: clientId,
    id: id,
    invoice: invoice,
    seller_bot_user_id: seller_bot_user_id,
    payment_provider_user_id: payment_provider_user_id,
    payment_provider: payment_provider,
    additional_payment_options: additional_payment_options,
    saved_order_info: saved_order_info,
    saved_credentials: saved_credentials,
    can_save_credentials: can_save_credentials,
    need_password: need_password,
    product_title: product_title,
    product_description: product_description,
    product_photo: product_photo,
  );
}