add authorCount variable for mapping how many quotes everybody has
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user