copyWith method

FeatureRequestItem copyWith({
  1. bool? hasVoted,
  2. int? voteCount,
})

Creates a copy of this FeatureRequestItem with updated properties.

Commonly used for optimistic vote toggles in UI widgets.

Example

final updated = item.copyWith(
  hasVoted: true,
  voteCount: item.voteCount + 1,
);

Implementation

FeatureRequestItem copyWith({
  bool? hasVoted,
  int? voteCount,
}) {
  return FeatureRequestItem(
    id: id,
    appId: appId,
    title: title,
    description: description,
    status: status,
    columnId: columnId,
    columnSlug: columnSlug,
    columnName: columnName,
    columnColor: columnColor,
    versionId: versionId,
    versionLabel: versionLabel,
    releasedVersion: releasedVersion,
    requesterName: requesterName,
    requesterAvatarUrl: requesterAvatarUrl,
    requesterClerkId: requesterClerkId,
    approved: approved,
    voteCount: voteCount ?? this.voteCount,
    hasVoted: hasVoted ?? this.hasVoted,
    isOwnRequest: isOwnRequest,
    recentCommenters: recentCommenters,
    hasMoreCommenters: hasMoreCommenters,
    createdAt: createdAt,
    updatedAt: updatedAt,
  );
}