fromMap static method

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

Construct from Map.

Implementation

static InputMessagePoll? 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 question = _map['question']! as String;
  var options = List<String>.from(
    (_map["options"] ?? []).map(
      (e) => e as String,
    ),
  );
  var is_anonymous = _map['is_anonymous']! as bool;
  var type = PollType.fromMap(_map['type'])!;
  var open_period = _map['open_period']! as int;
  var close_date = _map['close_date']! as int;
  var is_closed = _map['is_closed']! as bool;
  return InputMessagePoll(
    extra: extra,
    clientId: clientId,
    question: question,
    options: options,
    is_anonymous: is_anonymous,
    type: type,
    open_period: open_period,
    close_date: close_date,
    is_closed: is_closed,
  );
}