fromMap static method

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

Construct from Map.

Implementation

static SponsoredMessage? 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 message_id = _map['message_id']! as int;
  var is_recommended = _map['is_recommended']! as bool;
  var content = MessageContent.fromMap(_map['content'])!;
  var sponsor = MessageSponsor.fromMap(_map['sponsor'])!;
  var additional_info = _map['additional_info']! as String;
  return SponsoredMessage(
    extra: extra,
    clientId: clientId,
    message_id: message_id,
    is_recommended: is_recommended,
    content: content,
    sponsor: sponsor,
    additional_info: additional_info,
  );
}