fromMap static method

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

Construct from Map.

Implementation

static MessageInvoice? 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 title = _map['title']! as String;
  var description = FormattedText.fromMap(_map['description'])!;
  var photo = Photo.fromMap(_map['photo']);
  var currency = _map['currency']! as String;
  var total_amount = _map['total_amount']! as int;
  var start_parameter = _map['start_parameter']! as String;
  var is_test = _map['is_test']! as bool;
  var need_shipping_address = _map['need_shipping_address']! as bool;
  var receipt_message_id = _map['receipt_message_id']! as int;
  var extended_media = MessageExtendedMedia.fromMap(_map['extended_media']);
  return MessageInvoice(
    extra: extra,
    clientId: clientId,
    title: title,
    description: description,
    photo: photo,
    currency: currency,
    total_amount: total_amount,
    start_parameter: start_parameter,
    is_test: is_test,
    need_shipping_address: need_shipping_address,
    receipt_message_id: receipt_message_id,
    extended_media: extended_media,
  );
}