copyWith method

PollOption copyWith({
  1. String? id,
  2. FormattedText? text,
  3. PollMedia? media()?,
  4. int? voterCount,
  5. int? votePercentage,
  6. List<MessageSender>? recentVoterIds,
  7. bool? isChosen,
  8. bool? isBeingChosen,
  9. MessageSender? author()?,
  10. int? additionDate,
})

Returns a copy with the given fields replaced. For a nullable field pass a function, e.g. field: () => null to clear it.

Implementation

PollOption copyWith({
  String? id,
  FormattedText? text,
  PollMedia? Function()? media,
  int? voterCount,
  int? votePercentage,
  List<MessageSender>? recentVoterIds,
  bool? isChosen,
  bool? isBeingChosen,
  MessageSender? Function()? author,
  int? additionDate,
}) => PollOption(
  id: id ?? this.id,
  text: text ?? this.text,
  media: media != null ? media() : this.media,
  voterCount: voterCount ?? this.voterCount,
  votePercentage: votePercentage ?? this.votePercentage,
  recentVoterIds: recentVoterIds ?? this.recentVoterIds,
  isChosen: isChosen ?? this.isChosen,
  isBeingChosen: isBeingChosen ?? this.isBeingChosen,
  author: author != null ? author() : this.author,
  additionDate: additionDate ?? this.additionDate,
);