add authorCount variable for mapping how many quotes everybody has

This commit is contained in:
odweta
2026-04-03 13:20:31 +02:00
parent 1c8357165f
commit fbcddec8c9
+14
View File
@@ -38,6 +38,20 @@ class QuoteProvider extends ChangeNotifier {
return filtered;
}
Map<String, int> get authorCounts {
final counts = <String, int>{};
for (var quote in filteredQuotes) {
counts.update(
quote.author,
(value) => value + 1,
ifAbsent: () => 1,
);
}
return counts;
}
final QuoteRepository repo = QuoteRepository();
int filterBy = 0; // 0 = by author, 1 = by quote