Skip to content

Commit

Permalink
Merge pull request #20 from shaunramsey/main
Browse files Browse the repository at this point in the history
the totalVotes forced to update
  • Loading branch information
thenifemi committed Aug 9, 2023
2 parents fc4ef5b + dca1ad9 commit 6f6711a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/flutter_polls.dart
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,12 @@ class FlutterPolls extends HookWidget {
)
.toList()
.first);
final myTotalVotes = pollOptions.fold(0, (acc, option) => acc + option.votes,);
final totalVotes = useState<int>(pollOptions.fold(
0,
(acc, option) => acc + option.votes,
(acc, option) => acc + option.votes,
));
totalVotes.value = myTotalVotes;

return Column(
key: ValueKey(pollId),
Expand Down

0 comments on commit 6f6711a

Please sign in to comment.