From 272637078a5b894f5cd940cf93bc581842cc7900 Mon Sep 17 00:00:00 2001 From: Username1548 Date: Wed, 21 May 2025 21:45:22 +0700 Subject: [PATCH] feat(notifications): added json parsing for notifications and tested impplementation of notifications layoute --- lib/core/app_router.dart | 10 +- lib/core/locator_service.dart | 6 +- .../feed/models/plan_pagination_model.dart | 2 - .../models/notification_model.dart | 146 ++++++++---------- .../notifications_cubit.dart | 89 ++++++++++- .../widgets/notification_widget.dart | 15 +- .../service/notifications_service.dart | 49 +++--- lib/main.dart | 2 +- 8 files changed, 203 insertions(+), 116 deletions(-) diff --git a/lib/core/app_router.dart b/lib/core/app_router.dart index 1c7210ac..ecd35ce9 100644 --- a/lib/core/app_router.dart +++ b/lib/core/app_router.dart @@ -103,7 +103,15 @@ class AppRouter { return const NoTransitionPage(child: ProfileScreen()); }, ), - GoRoute(path: '/feed-screen', name: 'feedScreen', pageBuilder: (context, state) => const NoTransitionPage(child: FeedScreen())), + GoRoute( + path: '/feed-screen', + name: 'feedScreen', + pageBuilder: (context, state) => const NoTransitionPage(child: FeedScreen()), + redirect: (context, state) async { + await sl().initialize(); + return null; + }, + ), GoRoute(path: '/diary-screen', name: 'diaryScreen', pageBuilder: (context, state) => const NoTransitionPage(child: DiaryScreen())), GoRoute( path: ConsultationsScreen.path, diff --git a/lib/core/locator_service.dart b/lib/core/locator_service.dart index 15bb5270..57f922e5 100644 --- a/lib/core/locator_service.dart +++ b/lib/core/locator_service.dart @@ -64,6 +64,8 @@ import 'package:eatvio_app/features/my_finance/services/cards_service.dart'; import 'package:eatvio_app/features/my_plans/presentation/cubit/my_plans_cubit.dart'; import 'package:eatvio_app/features/my_plans/repositories/my_diets_repository.dart'; import 'package:eatvio_app/features/my_plans/services/my_plans_service.dart'; +import 'package:eatvio_app/features/notifications/repository/notifications_repository.dart'; +import 'package:eatvio_app/features/notifications/service/notifications_service.dart'; import 'package:eatvio_app/features/order_info/cubit/order_info_cubit.dart'; import 'package:eatvio_app/features/plans/repositories/plans_repository.dart'; import 'package:eatvio_app/features/plans/services/plans_service.dart'; @@ -97,7 +99,7 @@ Future init() async { // Cubit singletons sl.registerLazySingleton(() => WsManager(wsService: sl())); sl.registerLazySingleton(() => NewMessagesCubit()); - sl.registerLazySingleton(() => NotificationsCubit(wsManager: sl())); + sl.registerLazySingleton(() => NotificationsCubit(wsManager: sl(), notificationsRepository: sl())); sl.registerLazySingleton(() => ProfileAvatarCubit(profileRepository: sl())); sl.registerLazySingleton(() => ChatsCubit(chatRepository: sl(), wsManager: sl(), profileRepository: sl())); @@ -161,6 +163,7 @@ Future init() async { sl.registerLazySingleton(() => ConsultationsRepository(consultationService: sl())); sl.registerLazySingleton(() => CancelPlanRepository(cancelService: sl())); sl.registerLazySingleton(() => CreatePlanRepository(createPlanService: sl())); + sl.registerLazySingleton(() => NotificationsRepository(notificationsService: sl())); // Services sl.registerLazySingleton(() => ChatService(sl())); @@ -188,6 +191,7 @@ Future init() async { sl.registerLazySingleton(() => ConsultationService(sl())); sl.registerLazySingleton(() => CancelPlanService(sl())); sl.registerLazySingleton(() => CreatePlanService(sl())); + sl.registerLazySingleton(() => NotificationsService(sl())); // External sl.registerLazySingleton( diff --git a/lib/features/feed/models/plan_pagination_model.dart b/lib/features/feed/models/plan_pagination_model.dart index 41c15983..e87d32c4 100644 --- a/lib/features/feed/models/plan_pagination_model.dart +++ b/lib/features/feed/models/plan_pagination_model.dart @@ -1,5 +1,3 @@ -import 'dart:ffi'; - import 'package:eatvio_app/core/models/pagination_model.dart'; import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart'; import 'package:eatvio_app/features/my_finance/models/card_model.dart'; diff --git a/lib/features/notifications/models/notification_model.dart b/lib/features/notifications/models/notification_model.dart index 47942287..f0b7b8b3 100644 --- a/lib/features/notifications/models/notification_model.dart +++ b/lib/features/notifications/models/notification_model.dart @@ -1,5 +1,3 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; - abstract class BaseNotificationModel { abstract final NotificationType type; } @@ -18,12 +16,13 @@ class PlanSubscriptionStartedToAuthorNotification implements BaseNotificationMod required this.chatId, }); - factory PlanSubscriptionStartedToAuthorNotification.fromRest(Map json) { - throw UnimplementedError(); - } - - factory PlanSubscriptionStartedToAuthorNotification.fromWebSocket(Map json) { - throw UnimplementedError(); + factory PlanSubscriptionStartedToAuthorNotification.fromJson(Map json, NotificationType type) { + return PlanSubscriptionStartedToAuthorNotification( + type: type, + planName: json['plan_name'], + customerName: json['user_name'], + chatId: json['chat_id'], + ); } } @@ -39,12 +38,12 @@ class PlanSubscriptionCanceledToAuthorNotification implements BaseNotificationMo required this.customerName, }); - factory PlanSubscriptionCanceledToAuthorNotification.fromRest(Map json) { - throw UnimplementedError(); - } - - factory PlanSubscriptionCanceledToAuthorNotification.fromWebSocket(Map json) { - throw UnimplementedError(); + factory PlanSubscriptionCanceledToAuthorNotification.fromJson(Map json, NotificationType type) { + return PlanSubscriptionCanceledToAuthorNotification( + type: type, + planName: json['plan_name'], + customerName: json['user_name'], + ); } } @@ -60,12 +59,12 @@ class ChosenPlanStartedToClientNotification implements BaseNotificationModel { required this.planId, }); - factory ChosenPlanStartedToClientNotification.fromRest(Map json) { - throw UnimplementedError(); - } - - factory ChosenPlanStartedToClientNotification.fromWebSocket(Map json) { - throw UnimplementedError(); + factory ChosenPlanStartedToClientNotification.fromJson(Map json, NotificationType type) { + return ChosenPlanStartedToClientNotification( + type: type, + planName: json['plan_name'], + planId: json['plan_id'], + ); } } @@ -79,12 +78,11 @@ class ChosenPlanTomorrowReminderToClientNotification implements BaseNotification required this.planName, }); - factory ChosenPlanTomorrowReminderToClientNotification.fromRest(Map json) { - throw UnimplementedError(); - } - - factory ChosenPlanTomorrowReminderToClientNotification.fromWebSocket(Map json) { - throw UnimplementedError(); + factory ChosenPlanTomorrowReminderToClientNotification.fromJson(Map json, NotificationType type) { + return ChosenPlanTomorrowReminderToClientNotification( + type: type, + planName: json['plan_name'], + ); } } @@ -94,12 +92,10 @@ class DiaryReminderNotification implements BaseNotificationModel { DiaryReminderNotification({required this.type}); - factory DiaryReminderNotification.fromRest(Map json) { - throw UnimplementedError(); - } - - factory DiaryReminderNotification.fromWebSocket(Map json) { - throw UnimplementedError(); + factory DiaryReminderNotification.fromJson(Map json, NotificationType type) { + return DiaryReminderNotification( + type: type, + ); } } @@ -113,12 +109,8 @@ class ConsultantLeftCommentNotification implements BaseNotificationModel { required this.date, }); - factory ConsultantLeftCommentNotification.fromRest(Map json) { - throw UnimplementedError(); - } - - factory ConsultantLeftCommentNotification.fromWebSocket(Map json) { - throw UnimplementedError(); + factory ConsultantLeftCommentNotification.fromJson(Map json, NotificationType type) { + return ConsultantLeftCommentNotification(type: type, date: json['diary_date']); } } @@ -128,12 +120,10 @@ class PersonalizedDietIsDefinedNotification implements BaseNotificationModel { PersonalizedDietIsDefinedNotification({required this.type}); - factory PersonalizedDietIsDefinedNotification.fromRest(Map json) { - throw UnimplementedError(); - } - - factory PersonalizedDietIsDefinedNotification.fromWebSocket(Map json) { - throw UnimplementedError(); + factory PersonalizedDietIsDefinedNotification.fromJson(Map json, NotificationType type) { + return PersonalizedDietIsDefinedNotification( + type: type, + ); } } @@ -146,12 +136,8 @@ class ChosenPlanFinishedToClientNotification implements BaseNotificationModel { required this.planName, }); - factory ChosenPlanFinishedToClientNotification.fromRest(Map json) { - throw UnimplementedError(); - } - - factory ChosenPlanFinishedToClientNotification.fromWebSocket(Map json) { - throw UnimplementedError(); + factory ChosenPlanFinishedToClientNotification.fromJson(Map json, NotificationType type) { + return ChosenPlanFinishedToClientNotification(type: type, planName: json['plan_name']); } } @@ -164,12 +150,11 @@ class PlanSubscriptionCanceledToCustomerNotification implements BaseNotification required this.planName, }); - factory PlanSubscriptionCanceledToCustomerNotification.fromRest(Map json) { - throw UnimplementedError(); - } - - factory PlanSubscriptionCanceledToCustomerNotification.fromWebSocket(Map json) { - throw UnimplementedError(); + factory PlanSubscriptionCanceledToCustomerNotification.fromJson(Map json, NotificationType type) { + return PlanSubscriptionCanceledToCustomerNotification( + type: type, + planName: json['plan_name'], + ); } } @@ -184,12 +169,12 @@ class ChosenPlanStartedToConsultantNotification implements BaseNotificationModel required this.customerName, }); - factory ChosenPlanStartedToConsultantNotification.fromRest(Map json) { - throw UnimplementedError(); - } - - factory ChosenPlanStartedToConsultantNotification.fromWebSocket(Map json) { - throw UnimplementedError(); + factory ChosenPlanStartedToConsultantNotification.fromJson(Map json, NotificationType type) { + return ChosenPlanStartedToConsultantNotification( + type: type, + planName: json['plan_name'], + customerName: json['client_name'], + ); } } @@ -204,12 +189,12 @@ class ChosenPlanTomorrowReminderToConsultantNotification implements BaseNotifica required this.customerName, }); - factory ChosenPlanTomorrowReminderToConsultantNotification.fromRest(Map json) { - throw UnimplementedError(); - } - - factory ChosenPlanTomorrowReminderToConsultantNotification.fromWebSocket(Map json) { - throw UnimplementedError(); + factory ChosenPlanTomorrowReminderToConsultantNotification.fromJson(Map json, NotificationType type) { + return ChosenPlanTomorrowReminderToConsultantNotification( + type: type, + planName: json['plan_name'], + customerName: json['client_name'], + ); } } @@ -224,12 +209,12 @@ class PlanSubscriptionPaidToAuthorNotification implements BaseNotificationModel required this.customerName, }); - factory PlanSubscriptionPaidToAuthorNotification.fromRest(Map json) { - throw UnimplementedError(); - } - - factory PlanSubscriptionPaidToAuthorNotification.fromWebSocket(Map json) { - throw UnimplementedError(); + factory PlanSubscriptionPaidToAuthorNotification.fromJson(Map json, NotificationType type) { + return PlanSubscriptionPaidToAuthorNotification( + type: type, + planName: json['plan_name'], + customerName: json['user_name'], + ); } } @@ -246,12 +231,13 @@ class ChosenPlanFinishedToConsultantNotification implements BaseNotificationMode required this.planId, }); - factory ChosenPlanFinishedToConsultantNotification.fromRest(Map json) { - throw UnimplementedError(); - } - - factory ChosenPlanFinishedToConsultantNotification.fromWebSocket(Map json) { - throw UnimplementedError(); + factory ChosenPlanFinishedToConsultantNotification.fromJson(Map json, NotificationType type) { + return ChosenPlanFinishedToConsultantNotification( + type: type, + planName: json['plan_name'], + customerName: json['client_name'], + planId: json['plan_id'], + ); } } diff --git a/lib/features/notifications/presentation/notifications_cubit/notifications_cubit.dart b/lib/features/notifications/presentation/notifications_cubit/notifications_cubit.dart index bded5181..6bb8c2c0 100644 --- a/lib/features/notifications/presentation/notifications_cubit/notifications_cubit.dart +++ b/lib/features/notifications/presentation/notifications_cubit/notifications_cubit.dart @@ -1,22 +1,55 @@ +import 'dart:convert'; +import 'dart:developer'; + import 'package:eatvio_app/core/websockets/ws_manager.dart'; import 'package:eatvio_app/features/notifications/models/notification_model.dart'; import 'package:eatvio_app/features/notifications/presentation/notifications_cubit/notifications_state.dart'; +import 'package:eatvio_app/features/notifications/repository/notifications_repository.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; class NotificationsCubit extends Cubit { final List _notifications = []; final WsManager wsManager; - - NotificationsCubit({required this.wsManager}) : super(const NotificationsState.empty()) { + final NotificationsRepository notificationsRepository; + NotificationsCubit({ + required this.wsManager, + required this.notificationsRepository, + }) : super(const NotificationsState.empty()) { wsManager.newNotificationsStream?.listen((event) { _handleNotification(event.data); }); } + BaseNotificationModel _parseNotification(Map notificationJson, NotificationType type) { + try { + return switch (type) { + NotificationType.planSubscriptionStartedToAuthor => PlanSubscriptionStartedToAuthorNotification.fromJson(notificationJson, type), + NotificationType.planSubscriptionCanceledToAuthor => PlanSubscriptionCanceledToAuthorNotification.fromJson(notificationJson, type), + NotificationType.chosenPlanStartedToClientNotification => ChosenPlanStartedToClientNotification.fromJson(notificationJson, type), + NotificationType.chosenPlanTomorrowReminderToClientNotification => + ChosenPlanTomorrowReminderToClientNotification.fromJson(notificationJson, type), + NotificationType.diaryReminderNotification => DiaryReminderNotification.fromJson(notificationJson, type), + NotificationType.consultantLeftComment => ConsultantLeftCommentNotification.fromJson(notificationJson, type), + NotificationType.personalizedDietIsDefined => PersonalizedDietIsDefinedNotification.fromJson(notificationJson, type), + NotificationType.chosenPlanFinishedToClient => ChosenPlanFinishedToClientNotification.fromJson(notificationJson, type), + NotificationType.planSubscriptionCanceledToCustomer => PlanSubscriptionCanceledToAuthorNotification.fromJson(notificationJson, type), + NotificationType.chosenPlanStartedToConsultantNotification => ChosenPlanStartedToConsultantNotification.fromJson(notificationJson, type), + NotificationType.chosenPlanTomorrowReminderToConsultantNotification => + ChosenPlanTomorrowReminderToConsultantNotification.fromJson(notificationJson, type), + NotificationType.planSubscriptionPaidToAuthor => PlanSubscriptionPaidToAuthorNotification.fromJson(notificationJson, type), + NotificationType.chosenPlanFinishedToConsultant => ChosenPlanFinishedToConsultantNotification.fromJson(notificationJson, type), + NotificationType.unknown => UnknownNotification(type: type), + }; + } catch (e) { + return UnknownNotification(type: NotificationType.unknown); + } + } void _handleNotification(String notificationData) { - // final data = jsonDecode(notificationData) as Map; - // final notification = NotificationModel.fromJson(data); - // _notifications.add(notification); + final json = jsonDecode(notificationData) as Map; + final stringifiedType = json['notification_class_name']; + final type = NotificationType.getTypeFromString(stringifiedType); + final notification = _parseNotification(json, type); + _notifications.insert(0, notification); emit( NotificationsState.loaded( notifications: _notifications, @@ -24,4 +57,50 @@ class NotificationsCubit extends Cubit { ), ); } + + Future getNotifications() async { + try { + final notifications = await notificationsRepository.getNotifications(page: 1); + _notifications.clear(); + _notifications.addAll(notifications ?? []); + emit( + NotificationsState.loaded( + notifications: _notifications, + notificationsCount: _notifications.length, + ), + ); + } catch (e, st) { + log(e.toString(), stackTrace: st); + } + } } + +final qwe = { + 'event': 'IlluminateNotificationsEventsBroadcastNotificationCreated', + 'channel': 'private-message-events.36', + 'data': { + "plan_name": "Little Cheeseburger", + "plan_id": 18, + "user_name": "\u041b\u044f\u043f\u0438\u0441 \u041b\u0430\u043f\u0448\u0430", + "user_id": 53, + "user_photo_path": "https://dev2.eatvio.com/storage/profile-photos/X2aHwD6IOIFxEK8HM2d2oLuqio5BmocDLeWoH3Gs.jpg", + "chat_id": "3d14615d-1388-4833-8165-b40daa78f96a", + "chat_url": "https://dev2.eatvio.com/chat/3d14615d-1388-4833-8165-b40daa78f96a", + "notification_class_name": "App\\Notifications\\Plan\\PlanSubscriptionStartedToAuthor", + "database_type": "client-start-plan-subscription-to-author", + "id": "65cbea6d-1734-406e-b5da-79db270aed90", + "type": "client-start-plan-subscription-to-author" + } +}; +final qwe2 = { + "plan_name": "Little Cheeseburger", + "plan_id": 18, + "user_name": "\u041b\u044f\u043f\u0438\u0441 \u041b\u0430\u043f\u0448\u0430", + "user_id": 53, + "user_photo_path": "https://dev2.eatvio.com/storage/profile-photos/X2aHwD6IOIFxEK8HM2d2oLuqio5BmocDLeWoH3Gs.jpg", + "chat_url": "https://dev2.eatvio.com/chat/3d14615d-1388-4833-8165-b40daa78f96a", + "notification_class_name": "App\\Notifications\\Plan\\PlanSubscriptionCanceledToAuthor", + "database_type": "client-cancel-plan-subscription-to-author", + "id": "cf86d0e7-8ebb-4360-9b8a-b6df97e12aed", + "type": "client-cancel-plan-subscription-to-author" +}; diff --git a/lib/features/notifications/presentation/widgets/notification_widget.dart b/lib/features/notifications/presentation/widgets/notification_widget.dart index 5da2aa6c..4cff1067 100644 --- a/lib/features/notifications/presentation/widgets/notification_widget.dart +++ b/lib/features/notifications/presentation/widgets/notification_widget.dart @@ -1,3 +1,4 @@ +import 'package:eatvio_app/core/theme/theme_helper.dart'; import 'package:eatvio_app/features/notifications/models/notification_model.dart'; import 'package:flutter/material.dart'; @@ -6,9 +7,15 @@ class NotificationWidget extends StatelessWidget { final BaseNotificationModel notification; @override Widget build(BuildContext context) { - // return (notification.type) { - // NotificationType.userSubscribedNotification => const _UserSubscribedNotification(), - // }; - return Container(); + return Container( + width: MediaQuery.sizeOf(context).width, + height: 60, + margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 12), + decoration: BoxDecoration( + color: appTheme.green, + borderRadius: BorderRadius.circular(18), + ), + child: Center(child: Text(notification.type.name)), + ); } } diff --git a/lib/features/notifications/service/notifications_service.dart b/lib/features/notifications/service/notifications_service.dart index d5bd7354..b5b46e39 100644 --- a/lib/features/notifications/service/notifications_service.dart +++ b/lib/features/notifications/service/notifications_service.dart @@ -7,31 +7,36 @@ class NotificationsService { Future?> getNotifications({required int page}) async { try { - final response = await dio.get('api/profile/notifications?page=$page'); + final response = await dio.get('/api/profile/notifications?page=$page'); if (response.statusCode == 200) { - final data = response.data['data'] as List>; + final data = response.data['data'] as List; final notifications = data.map((notificationJson) { - final stringifiedType = notificationJson['data']['notification_class_name']; - final type = NotificationType.getTypeFromString(stringifiedType); - return switch (type) { - NotificationType.planSubscriptionStartedToAuthor => PlanSubscriptionStartedToAuthorNotification.fromRest(notificationJson), - NotificationType.planSubscriptionCanceledToAuthor => PlanSubscriptionCanceledToAuthorNotification.fromRest(notificationJson), - NotificationType.chosenPlanStartedToClientNotification => ChosenPlanStartedToClientNotification.fromRest(notificationJson), - NotificationType.chosenPlanTomorrowReminderToClientNotification => ChosenPlanTomorrowReminderToClientNotification.fromRest(notificationJson), - NotificationType.diaryReminderNotification => DiaryReminderNotification.fromRest(notificationJson), - NotificationType.consultantLeftComment => ConsultantLeftCommentNotification.fromRest(notificationJson), - NotificationType.personalizedDietIsDefined => PersonalizedDietIsDefinedNotification.fromRest(notificationJson), - NotificationType.chosenPlanFinishedToClient => ChosenPlanFinishedToClientNotification.fromRest(notificationJson), - NotificationType.planSubscriptionCanceledToCustomer => PlanSubscriptionCanceledToAuthorNotification.fromRest(notificationJson), - NotificationType.chosenPlanStartedToConsultantNotification => ChosenPlanStartedToConsultantNotification.fromRest(notificationJson), - NotificationType.chosenPlanTomorrowReminderToConsultantNotification => - ChosenPlanTomorrowReminderToConsultantNotification.fromRest(notificationJson), - NotificationType.planSubscriptionPaidToAuthor => PlanSubscriptionPaidToAuthorNotification.fromRest(notificationJson), - NotificationType.chosenPlanFinishedToConsultant => ChosenPlanFinishedToConsultantNotification.fromRest(notificationJson), - NotificationType.unknown => UnknownNotification(type: type), - }; + try { + final stringifiedType = notificationJson['data']['notification_class_name']; + final type = NotificationType.getTypeFromString(stringifiedType); + return switch (type) { + NotificationType.planSubscriptionStartedToAuthor => PlanSubscriptionStartedToAuthorNotification.fromJson(notificationJson['data'], type), + NotificationType.planSubscriptionCanceledToAuthor => PlanSubscriptionCanceledToAuthorNotification.fromJson(notificationJson['data'], type), + NotificationType.chosenPlanStartedToClientNotification => ChosenPlanStartedToClientNotification.fromJson(notificationJson['data'], type), + NotificationType.chosenPlanTomorrowReminderToClientNotification => + ChosenPlanTomorrowReminderToClientNotification.fromJson(notificationJson['data'], type), + NotificationType.diaryReminderNotification => DiaryReminderNotification.fromJson(notificationJson['data'], type), + NotificationType.consultantLeftComment => ConsultantLeftCommentNotification.fromJson(notificationJson['data'], type), + NotificationType.personalizedDietIsDefined => PersonalizedDietIsDefinedNotification.fromJson(notificationJson['data'], type), + NotificationType.chosenPlanFinishedToClient => ChosenPlanFinishedToClientNotification.fromJson(notificationJson['data'], type), + NotificationType.planSubscriptionCanceledToCustomer => PlanSubscriptionCanceledToAuthorNotification.fromJson(notificationJson['data'], type), + NotificationType.chosenPlanStartedToConsultantNotification => ChosenPlanStartedToConsultantNotification.fromJson(notificationJson['data'], type), + NotificationType.chosenPlanTomorrowReminderToConsultantNotification => + ChosenPlanTomorrowReminderToConsultantNotification.fromJson(notificationJson['data'], type), + NotificationType.planSubscriptionPaidToAuthor => PlanSubscriptionPaidToAuthorNotification.fromJson(notificationJson['data'], type), + NotificationType.chosenPlanFinishedToConsultant => ChosenPlanFinishedToConsultantNotification.fromJson(notificationJson['data'], type), + NotificationType.unknown => UnknownNotification(type: type), + }; + } catch (e) { + return UnknownNotification(type: NotificationType.unknown); + } }).toList(); - return notifications; + return notifications.where((notification) => notification.type != NotificationType.unknown).toList(); } return null; } catch (e) { diff --git a/lib/main.dart b/lib/main.dart index 29f7bdf8..d7d37793 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -39,7 +39,7 @@ class MyApp extends StatelessWidget { return MultiBlocProvider( providers: [ BlocProvider(create: (context) => sl()), - BlocProvider(create: (context) => sl()), + BlocProvider(create: (context) => sl()..getNotifications()), BlocProvider(create: (context) => sl()..loadFeedBlogPostList()), BlocProvider(create: (context) => sl()..getMyProfile()), BlocProvider(create: (context) => sl()..getChatRoomsWithLoading()),