unreadAll method
Marks all notifications as unread.
Implementation
Future<void> unreadAll() async {
if (!state.hasData) return;
log('Marking all notifications as unread');
final read = state.requireData.where((element) => element.read).toList();
if (read.isEmpty) {
log('No notifications to mark as unread');
return;
}
log('Marking ${read.length} notifications as unread');
await _datasource.unreadAll(
_auth.state.requireData[Webservice.lb_planner_api],
read,
);
emit(
AsyncValue.data(
state.requireData.map((e) => e.copyWith(read: false)).toList(),
),
);
log('All notifications marked as unread');
await captureEvent('notifications_unread');
}