Aidra Connect 10.0.2+16
Aidra Connect Mobile Application
Loading...
Searching...
No Matches
notifications_cubit.dart
Go to the documentation of this file.
1import '/features/notifications/domain/entities/notification_entity.dart';
2import '/features/notifications/domain/usecases/load_notifications_use_case.dart';
3import 'package:bloc/bloc.dart';
4import 'package:dartz/dartz.dart';
5import 'package:equatable/equatable.dart';
6
7import '../../../../../core/errors/failures.dart';
8import '../../../../../core/services/service_locator.dart';
9
10part 'notifications_state.dart';
11
12class NotificationsCubit extends Cubit<NotificationsState> {
14
15 NotificationsCubit() : super(NotificationsInitial());
16
17 Future<void> loadNotifications(String userId) async {
18 emit(LoadingNotificationsState());
19 final Either<Failure, List<NotificationEntity>> result =
20 await _loadNotificationsUseCase.call(userId);
21 result.fold(
22 (failure) => emit(
24 ),
25 (notifications) => emit(
26 NotificationsLoadedState(notifications: notifications),
27 ),
28 );
29 }
30}
NotificationsCubit() Future< void > loadNotifications(String userId) async
sealed class DocumentState extends Equatable failure
const NotificationsLoadingFailureState({required this.failure})
notifications
Definition routes.dart:73
final sl