create static method

Poll create({
  1. bool schemeUtilsIsSetDefaultData = false,
  2. String special_type = "poll",
  3. String special_return_type = "poll",
  4. num? id,
  5. FormattedText? question,
  6. List<PollOption>? options,
  7. num? total_voter_count,
  8. List<MessageSender>? recent_voter_ids,
  9. bool? is_anonymous,
  10. PollType? type,
  11. num? open_period,
  12. num? close_date,
  13. bool? is_closed,
})
override

Generate By AZKADEV | Azka Axelion Gibran Script Dont edit by hand or anything manual

Implementation

static Poll create({
  bool schemeUtilsIsSetDefaultData = false,
  String special_type = "poll",
  String special_return_type = "poll",
  num? id,
  FormattedText? question,
  List<PollOption>? options,
  num? total_voter_count,
  List<MessageSender>? recent_voter_ids,
  bool? is_anonymous,
  PollType? type,
  num? open_period,
  num? close_date,
  bool? is_closed,
}) {
  // Poll poll = Poll({
  final Map poll_data_create_json = {
    "@type": special_type,
    "@return_type": special_return_type,
    "id": id,
    "question": (question != null) ? question.toJson() : null,
    "options": (options != null) ? options.toJson() : null,
    "total_voter_count": total_voter_count,
    "recent_voter_ids": (recent_voter_ids != null) ? recent_voter_ids.toJson() : null,
    "is_anonymous": is_anonymous,
    "type": (type != null) ? type.toJson() : null,
    "open_period": open_period,
    "close_date": close_date,
    "is_closed": is_closed,
  };

  poll_data_create_json.removeWhere((key, value) => value == null);

  if (schemeUtilsIsSetDefaultData) {
    defaultData.forEach((key, value) {
      if (poll_data_create_json.containsKey(key) == false) {
        poll_data_create_json[key] = value;
      }
    });
  }
  return Poll(poll_data_create_json);
}