/// Notifications Providers /// /// Riverpod providers for managing notification state. library; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:worker/features/notifications/data/datasources/notification_local_datasource.dart'; import 'package:worker/features/notifications/data/repositories/notification_repository_impl.dart'; import 'package:worker/features/notifications/domain/entities/notification.dart'; import 'package:worker/features/notifications/domain/repositories/notification_repository.dart'; /// Notification Local Data Source Provider final notificationLocalDataSourceProvider = Provider((ref) { return NotificationLocalDataSource(); }); /// Notification Repository Provider final notificationRepositoryProvider = Provider((ref) { final localDataSource = ref.watch(notificationLocalDataSourceProvider); return NotificationRepositoryImpl(localDataSource: localDataSource); }); /// All Notifications Provider final notificationsProvider = FutureProvider>((ref) async { final repository = ref.watch(notificationRepositoryProvider); return await repository.getAllNotifications(); }); /// Filtered Notifications Provider (by category parameter) /// Use .family to pass category as parameter from UI final filteredNotificationsProvider = FutureProvider.family, String>((ref, category) async { final repository = ref.watch(notificationRepositoryProvider); return await repository.getNotificationsByCategory(category); }); /// Unread Count Provider final unreadNotificationCountProvider = FutureProvider((ref) async { final repository = ref.watch(notificationRepositoryProvider); return await repository.getUnreadCount(); });