Poll.fromJson constructor

Poll.fromJson(
  1. Map<String, dynamic> json
)

Parses a Poll from TDLib JSON.

Implementation

factory Poll.fromJson(Map<String, dynamic> json) => Poll(
      id: _readInt(json['id']),
      question: _readString(json['question']),
      options: _readList<PollOption>(
          json['options'], (e) => _readObject(e, PollOption.fromJson)),
      totalVoterCount: _readInt(json['total_voter_count']),
      recentVoterIds: _readList<MessageSender>(json['recent_voter_ids'],
          (e) => _readObject(e, MessageSender.fromJson)),
      isAnonymous: _readBool(json['is_anonymous']),
      type: _readObject(json['type'], PollType.fromJson),
      openPeriod: _readInt(json['open_period']),
      closeDate: _readInt(json['close_date']),
      isClosed: _readBool(json['is_closed']),
    );