servicesOfJournal function Providers
- @Riverpod(keepAlive: true)
Provider of groups of ServiceOfJournal sorted by ServiceState.
Implementation
@Riverpod(keepAlive: true)
Map<ServiceState, List<ServiceOfJournal>> servicesOfJournal(
Ref ref, Journal journal) {
if (journal.aData == null) {
final journalServices =
ref.watch(hiveRepositoryProvider(journal.worker.apiKey));
return groupBy<ServiceOfJournal, ServiceState>(
journalServices,
(e) => e.state,
);
} else {
final journalServices =
ref.watch(archiveReaderProvider(journal.worker.apiKey));
return groupBy<ServiceOfJournal, ServiceState>(
journalServices.where((e) => e.provDate.dateOnly() == journal.aData),
(e) => e.state,
);
}
}