fromMap static method

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

Construct from Map.

Implementation

static AvailableReactions? 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 top_reactions = List<AvailableReaction>.from(
    (_map["top_reactions"] ?? []).map(
      (e) => AvailableReaction.fromMap(e),
    ),
  );
  var recent_reactions = List<AvailableReaction>.from(
    (_map["recent_reactions"] ?? []).map(
      (e) => AvailableReaction.fromMap(e),
    ),
  );
  var popular_reactions = List<AvailableReaction>.from(
    (_map["popular_reactions"] ?? []).map(
      (e) => AvailableReaction.fromMap(e),
    ),
  );
  var allow_custom_emoji = _map['allow_custom_emoji']! as bool;
  return AvailableReactions(
    extra: extra,
    clientId: clientId,
    top_reactions: top_reactions,
    recent_reactions: recent_reactions,
    popular_reactions: popular_reactions,
    allow_custom_emoji: allow_custom_emoji,
  );
}