fromMap static method

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

Construct from Map.

Implementation

static MessageReaction? 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 type = ReactionType.fromMap(_map['type'])!;
  var total_count = _map['total_count']! as int;
  var is_chosen = _map['is_chosen']! as bool;
  var recent_sender_ids = List<MessageSender>.from(
    (_map["recent_sender_ids"] ?? []).map(
      (e) => MessageSender.fromMap(e),
    ),
  );
  return MessageReaction(
    extra: extra,
    clientId: clientId,
    type: type,
    total_count: total_count,
    is_chosen: is_chosen,
    recent_sender_ids: recent_sender_ids,
  );
}