import 'dart:async'; import 'dart:convert'; import 'dart:io'; import 'package:get/get.dart'; import 'package:onufitness/constants/api_enum_constant.dart'; import 'package:onufitness/controller/get_agora_token_controller.dart'; import 'package:onufitness/controller/notification_controller.dart'; import 'package:onufitness/routes/route_constant.dart'; import 'package:onufitness/screens/accounts/Controllers/coach_rating_controller.dart'; import 'package:onufitness/screens/chat/controllers/chat_controller.dart'; import 'package:onufitness/screens/chat/views/chat_inside_screen.dart'; import 'package:onufitness/screens/echoboard/controllers/connection_and_tribe_controller.dart'; import 'package:onufitness/screens/echoboard/controllers/echoboard_controller.dart'; import 'package:onufitness/screens/echoboard/views/single_post_screen.dart'; import 'package:onufitness/screens/echoboard/views/tribe_echoboard/tribe_echoboard_post_list_screen.dart'; import 'package:onufitness/screens/goals/controllers/goal_controller.dart'; import 'package:onufitness/screens/login/views/login_screen.dart'; import 'package:onufitness/screens/navbar/bottom_nav_bar.dart'; import 'package:onufitness/screens/rise/controllers/rise_controller.dart'; import 'package:onufitness/screens/streamming/controllers/get_api_live_streams_controller.dart'; import 'package:onufitness/services/agora/agora_chat_service.dart'; import 'package:onufitness/services/agora/call_services.dart'; import 'package:onufitness/services/local_storage_services/shared_services.dart'; import 'package:onufitness/utils/custom_sneakbar.dart'; class NotificationNavigationController extends GetxController { RxString streamID = "".obs; RxBool isCallingNotificationNavigation = false.obs; RxBool isNotificationNavigation = false.obs; void setFlagsFromPayload(Map data) { try { final notificationType = data['notificationType']; int? typeAsInt; if (notificationType is int) { typeAsInt = notificationType; } else if (notificationType is String) { typeAsInt = int.tryParse(notificationType); } // Set flags based on notification type if (typeAsInt != null && typeAsInt == ApiEnum.CallingNotification) { isCallingNotificationNavigation.value = true; isNotificationNavigation.value = false; } else { isNotificationNavigation.value = true; isCallingNotificationNavigation.value = false; } } catch (e) { // Fallback to normal notification isNotificationNavigation.value = true; isCallingNotificationNavigation.value = false; } } Future navigateBasedOnNotification(Map data) async { await Future.delayed(const Duration(milliseconds: 100)); //................................................................................ try { final notificationType = data['notificationType']; // Convert string to integer for comparison int? typeAsInt; if (notificationType is int) { typeAsInt = notificationType; } else if (notificationType is String) { typeAsInt = int.tryParse(notificationType); } if (typeAsInt == ApiEnum.LiveStream) { try { if (data['dataId'] != null) { var dataId = data['dataId']; // If dataId is a string (JSON), parse it if (dataId is String) { final parsedDataId = jsonDecode(dataId); if (parsedDataId is Map && parsedDataId['StreamID'] != null) { streamID.value = parsedDataId['StreamID'].toString(); } } // If dataId is already a Map else if (dataId is Map && dataId['StreamID'] != null) { streamID.value = dataId['StreamID'].toString(); } } } catch (e) { // Error parsing dataId } } // Use if-else instead of switch to avoid type issues if (typeAsInt == ApiEnum.Goal) { await navigateToGoalScreen(); } else if (typeAsInt == ApiEnum.Challenge) { await navigateToChallengeScreen(); } else if (typeAsInt == ApiEnum.ConnectionRequest) { await navigateToConnectionRequestScreen(); } else if (typeAsInt == ApiEnum.Post) { await navigateToPostScreen(data); } else if (typeAsInt == ApiEnum.RequestAccepted) { await navigateToFriendsScreen(); } else if (typeAsInt == ApiEnum.CoachRequest) { navigateToDefault(); } else if (typeAsInt == ApiEnum.ReportPost) { navigateToDefault(); } else if (typeAsInt == ApiEnum.ChallengeCompleted) { await navigateToJoinedChallengeTab(); } else if (typeAsInt == ApiEnum.GoalCompleted) { await navigateToJoinedGoaltab(); } else if (typeAsInt == ApiEnum.LiveStream) { await navigateToLiveStreamScreen(); } else if (typeAsInt == ApiEnum.CallingNotification) { await navigateToCallScreen(data); } else if (typeAsInt == ApiEnum.CommentPost) { await navigateToPostScreen(data); } else if (typeAsInt == ApiEnum.ReactPost) { await navigateToPostScreen(data); } else if (typeAsInt == ApiEnum.SubCommentPost) { await navigateToPostScreen(data); } else if (typeAsInt == ApiEnum.CoachApproval) { navigateToDefault; } else if (typeAsInt == ApiEnum.RemainGoal) { await navigateToJoinedGoaltab(); } else if (typeAsInt == ApiEnum.RemainChallenge) { await navigateToJoinedChallengeTab(); } else if (typeAsInt == ApiEnum.GoalProgressStatus) { await navigateToJoinedGoaltab(); } else if (typeAsInt == ApiEnum.ChallengeProgressStatus) { await navigateToJoinedChallengeTab(); } else if (typeAsInt == ApiEnum.AddTribeMember) { await navigateToViewTribeScreen(data); } else if (typeAsInt == ApiEnum.CallingNotificationCancel) { await navigateToChatDetailScreen(data); } else if (typeAsInt == ApiEnum.ChatNotification) { await navigateToChatDetailScreen(data); } else if (typeAsInt == ApiEnum.GroupChatNotification) { await navigateToGroupChatDetailsScreen(data); } else { navigateToDefault(); } } catch (e) { navigateToDefault(); } } //.................................................................................................................................... //.......................................................................................................................... Future navigateToCallScreen(Map data) async { isCallingNotificationNavigation.value = true; try { if (!Get.isRegistered()) { Get.put(AgoraCallService()); } await AgoraCallService.instance.init(); String? dataIdString = data['dataId']; Map? notificationCallData; if (dataIdString != null) { try { notificationCallData = jsonDecode(dataIdString); } catch (e) { // Error parsing dataId } } if (notificationCallData != null) { // Setup call data in Agora service AgoraCallService.instance.channelName.value = notificationCallData['ChannelName'] ?? ''; AgoraCallService.instance.remoteUserId.value = notificationCallData['UserID'] ?? ''; AgoraCallService.instance.callerProfilePic.value = notificationCallData['ProfilePicture'] ?? ''; AgoraCallService.instance.callerName.value = notificationCallData['CallerName'] ?? ''; AgoraCallService.instance.currentCallType.value = notificationCallData['CallType'] == 'VIDEO' ? CallType.video : CallType.voice; AgoraCallService.instance.callState.value = CallState.ringing; AgoraCallService.instance.amICaller.value = false; if (AgoraCallService.instance.currentCallType.value == CallType.video) { await AgoraCallService.instance.startVideoPreview(); } // Fetch RTC token here (important for terminated state) if (!Get.isRegistered()) { Get.put(AgoraTokenController()); } final agoraTokenController = Get.find(); bool tokenOk = await agoraTokenController.getRTCtoken( channelName: AgoraCallService.instance.channelName.value, role: ApiEnum.SUBSCRIBER, ); if (tokenOk) { AgoraCallService.instance.rtcToken.value = agoraTokenController.rTCtoken.value; } if (Platform.isIOS && (Get.currentRoute != RouteConstant.incomingCallScreen && Get.currentRoute != RouteConstant.splashScreen)) { // Navigate to incoming call screen Get.toNamed(RouteConstant.incomingCallScreen); } } else { navigateToDefault(); } } catch (e) { navigateToDefault(); } } //================================================================================================================== //....Below codes is Chat Related code............................................................................... //================================================================================================================== // Future navigateToChatListScreen() async { // isNotificationNavigation(true); // try { // if (Get.currentRoute == RouteConstant.splashScreen) { // Get.offNamedUntil( // RouteConstant.dashboardScreen, // (route) => false, // arguments: 0, // ); // } // //.................................................. // if (!Get.isRegistered()) { // Get.put(ChatController()); // } // if (!Get.isRegistered()) { // Get.put(RatingsReviewsController()); // } // if (!Get.isRegistered()) { // Get.put(NotificationController()); // if (!Get.isRegistered()) { // Get.put(NavigationController()); // } // if (!Get.isRegistered()) { // Get.put(EchoBoardController()); // } // } // //.................................................. // await agoraChatTokenAPIcall(); // Get.toNamed(RouteConstant.chatListScreen); // log("Navigated directly to Chat List Screen successfully"); // } catch (e) { // log("Error navigating to chat after dashboard load: $e"); // navigateToDefault(); // } // } //........................................................................................................................... Future navigateToChatDetailScreen(Map data) async { isNotificationNavigation(true); // Initialize required controllers if needed if (Get.currentRoute == RouteConstant.splashScreen) { Get.offNamedUntil( RouteConstant.dashboardScreen, (route) => false, arguments: 0, ); } try { // Parse dataId to get chat information String? dataIdString = data['dataId']; Map? chatData; if (dataIdString != null) { try { // Clean the JSON string by removing control characters String cleanedDataId = dataIdString .replaceAll( RegExp(r'[\n\r\t]'), ' ', ) // Replace newlines, returns, tabs with space .replaceAll( RegExp(r'\s+'), ' ', ) // Replace multiple spaces with single space .trim(); chatData = jsonDecode(cleanedDataId); } catch (e) { // Try alternative parsing if the above fails try { // Remove all control characters (ASCII 0-31 except space) String sanitizedDataId = dataIdString.replaceAll( RegExp(r'[\x00-\x09\x0B-\x0C\x0E-\x1F\x7F]'), '', ); chatData = jsonDecode(sanitizedDataId); } catch (e2) { // Failed to parse even after sanitization } } } if (chatData != null) { // Extract chat details final userId = chatData['UserID'] ?? ''; final callerName = chatData['CallerName'] ?? '${chatData['CallerFirstName'] ?? ''} ${chatData['CallerLastName'] ?? ''}' .trim(); final profilePicture = chatData['ProfilePicture'] ?? ''; if (!Get.isRegistered()) { Get.put(ChatController()); } if (!Get.isRegistered()) { Get.put(RatingsReviewsController()); } if (!Get.isRegistered()) { Get.put(NotificationController()); } if (!Get.isRegistered()) { Get.put(NavigationController()); } if (!Get.isRegistered()) { Get.put(EchoBoardController()); } if (!Get.isRegistered()) { Get.put(AgoraChatService()); } await agoraChatTokenAPIcall(); // Get ChatController and ensure it's initialized final chatController = Get.find(); // IMPORTANT: Set the selected user BEFORE navigating chatController.selectedUserId.value = userId; // Navigate directly to ChatDetailScreen Get.to( () => ChatDetailScreen( targetUserId: userId, targetUserName: callerName, targetUserAvatar: profilePicture, isGroupMessage: false, ), ); } else { navigateToDefault(); } } catch (e) { // Fallback to chat list screen on error navigateToDefault(); } } //................................................................................................................ Future navigateToGroupChatDetailsScreen( Map data, ) async { isNotificationNavigation(true); try { // Parse dataId to get tribe chat information String? dataIdString = data['dataId']; Map? chatData; if (dataIdString != null) { try { // Clean the JSON string by removing control characters String cleanedDataId = dataIdString .replaceAll( RegExp(r'[\n\r\t]'), ' ', ) // Replace newlines, returns, tabs with space .replaceAll( RegExp(r'\s+'), ' ', ) // Replace multiple spaces with single space .trim(); chatData = jsonDecode(cleanedDataId); } catch (e) { // Try alternative parsing if the above fails try { // Remove all control characters (ASCII 0-31 except space) String sanitizedDataId = dataIdString.replaceAll( RegExp(r'[\x00-\x09\x0B-\x0C\x0E-\x1F\x7F]'), '', ); chatData = jsonDecode(sanitizedDataId); } catch (e2) { // Failed to parse even after sanitization } } } if (chatData != null) { // Extract tribe chat details final tribeAgoraId = chatData['TribeAgoraId'] ?? ''; final tribrName = chatData['TribeName'] ?? ''; final tribeImage = chatData['TribeImage'] ?? ''; // Initialize required controllers if needed if (Get.currentRoute == RouteConstant.splashScreen) { Get.offNamedUntil( RouteConstant.dashboardScreen, (route) => false, arguments: 0, ); } if (!Get.isRegistered()) { Get.put(ChatController()); } if (!Get.isRegistered()) { Get.put(RatingsReviewsController()); } if (!Get.isRegistered()) { Get.put(NotificationController()); } if (!Get.isRegistered()) { Get.put(NavigationController()); } if (!Get.isRegistered()) { Get.put(EchoBoardController()); } await agoraChatTokenAPIcall(); // Get ChatController final chatController = Get.find(); // Set group chat flag and selected user chatController.isGroupChattt.value = true; Get.to( () => ChatDetailScreen( targetUserId: tribeAgoraId, targetUserName: tribrName, targetUserAvatar: tribeImage, isGroupMessage: true, ), ); } else { navigateToDefault(); } } catch (e) { // Fallback to chat list screen on error navigateToDefault(); } } //...................................................................................................... Future agoraChatTokenAPIcall() async { try { if (!Get.isRegistered()) { Get.put(AgoraTokenController()); } final agoraTokenController = Get.find(); final success = await agoraTokenController.getAgoraUserAndRrmToken(); if (success) { await agoraChatCallServicesLogin(); } else { // Agora token fetch failed } } catch (e) { // Error in agoraChatTokenAPIcall } } Future agoraChatCallServicesLogin() async { // Agora Chat Service Initialization await chatLoginToAgora(); //Small delay await Future.delayed(Duration(milliseconds: 500)); // Agora Call Service Initialization await Get.find().agoraRTMlogin(); } chatLoginToAgora() async { if (!Get.isRegistered()) { Get.put(await AgoraChatService().init(), permanent: true); } else { final chatService = Get.find(); await chatService.initChatSdk(); await chatService.loginToAgora(); } } //================================================================================================================== //....Above one is Chat Related code............................................................................... //================================================================================================================== Future navigateToGoalScreen() async { isNotificationNavigation(true); // Initialize required controllers if needed if (Get.currentRoute == RouteConstant.splashScreen) { Get.offNamedUntil( RouteConstant.dashboardScreen, (route) => false, arguments: 0, ); } try { // Ensure controllers are registered if (!Get.isRegistered()) { Get.put(NavigationController()); } if (!Get.isRegistered()) { Get.put(GoalController()); } final navController = Get.find(); final goalController = Get.find(); if (Get.currentRoute == RouteConstant.dashboardScreen) { await goalController.fetchAllExploreGoals(isRefresh: true); navController.changeIndex(2); } else { await goalController.fetchAllExploreGoals(isRefresh: true); Get.toNamed(RouteConstant.goalScreen, arguments: 2); } } catch (e) { navigateToDefault(); } } //.......................................................................................................................... Future navigateToJoinedGoaltab() async { isNotificationNavigation(true); // Initialize required controllers if needed if (Get.currentRoute == RouteConstant.splashScreen) { Get.offNamedUntil( RouteConstant.dashboardScreen, (route) => false, arguments: 0, ); } try { // Ensure controllers are registered if (!Get.isRegistered()) { Get.put(NavigationController()); } if (!Get.isRegistered()) { Get.put(GoalController()); } final navController = Get.find(); final goalController = Get.find(); if (Get.currentRoute == RouteConstant.dashboardScreen) { await goalController.fetchAllExploreGoals(isRefresh: true); navController.changeIndex(2); goalController.selectedTabIndex.value = 1; goalController.switchTab(1); } else { await goalController.fetchAllExploreGoals(isRefresh: true); Get.toNamed(RouteConstant.goalScreen, arguments: 2); goalController.selectedTabIndex.value = 1; goalController.switchTab(1); } } catch (e) { navigateToDefault(); } } //.......................................................................................................................... Future navigateToChallengeScreen() async { isNotificationNavigation(true); try { if (Get.currentRoute == RouteConstant.splashScreen) { Get.offNamedUntil( RouteConstant.dashboardScreen, (route) => false, arguments: 0, ); } //.................................................. if (!Get.isRegistered()) { Get.put(RatingsReviewsController()); } if (!Get.isRegistered()) { Get.put(ChatController()); } if (!Get.isRegistered()) { Get.put(NotificationController()); } if (!Get.isRegistered()) { Get.put(RiseController()); } //.................................................... final challengeController = Get.find(); Get.toNamed(RouteConstant.challengeListScreen); await challengeController.fetchOngoingChallenges(isRefresh: true); await challengeController.fetchUpcomingChallenges(isRefresh: true); await challengeController.fetchJoinedChallenges(isRefresh: true); } catch (e) { navigateToDefault(); } } //.......................................................................................................................... Future navigateToJoinedChallengeTab() async { isNotificationNavigation(true); try { if (Get.currentRoute == RouteConstant.splashScreen) { Get.offNamedUntil( RouteConstant.dashboardScreen, (route) => false, arguments: 0, ); } //.................................................. if (!Get.isRegistered()) { Get.put(RatingsReviewsController()); } if (!Get.isRegistered()) { Get.put(ChatController()); } if (!Get.isRegistered()) { Get.put(NotificationController()); } if (!Get.isRegistered()) { Get.put(RiseController()); } //................................................... final challengeController = Get.find(); Get.toNamed( RouteConstant.challengeListScreen, arguments: {'tabIndex': 2}, ); await challengeController.fetchJoinedChallenges(isRefresh: true); await challengeController.fetchOngoingChallenges(isRefresh: true); await challengeController.fetchUpcomingChallenges(isRefresh: true); } catch (e) { navigateToDefault(); } } //.......................................................................................................................... Future navigateToPostScreen(Map data) async { isNotificationNavigation(true); try { Map? dataIdMap; if (data['dataId'] != null && data['dataId'] is String) { dataIdMap = jsonDecode(data['dataId']); } final tribeId = dataIdMap?['TribeID']; // Check if TribeID exists and is not null/empty if (tribeId != null && tribeId.toString().isNotEmpty) { // Navigate to tribe echoboard await navigateToTribeEchoboardScreen(data); } else { // Navigate to regular echoboard await navigateToEchoboardScreen(data); } } catch (e) { navigateToDefault(); } } //.......................................................................................... //.......................................................................................... Future navigateToTribeEchoboardScreen(Map data) async { if (Get.currentRoute == RouteConstant.splashScreen) { Get.offNamedUntil( RouteConstant.dashboardScreen, (route) => false, arguments: 0, ); } try { Map? dataIdMap; if (data['dataId'] != null && data['dataId'] is String) { dataIdMap = jsonDecode(data['dataId']); } final postId = dataIdMap?['PostID']; final tribeId = dataIdMap?['TribeID']; if (postId == null || tribeId == null) { navigateToDefault(); return; } // Initialize controllers if (!Get.isRegistered()) { Get.put(SocialConnectionController()); } final socialConnectionController = Get.find(); // Load tribe details final tribeDetailsLoaded = await socialConnectionController .getSingleTribeDetails(tribeId: int.parse(tribeId.toString())); if (tribeDetailsLoaded) { controllerInitialization(); // Navigate to SinglePostPage with tribe context Get.to( () => SinglePostPage( postId: postId.toString(), tribeId: int.parse(tribeId.toString()), ), ); } else { customSnackbar( title: "Error", message: "Failed to load tribe details", duration: 2, ); navigateToDefault(); } } catch (e) { navigateToDefault(); } } //.......................................................................................................................... //.......................................................................................................................... Future navigateToEchoboardScreen(Map data) async { if (Get.currentRoute == RouteConstant.splashScreen) { Get.offNamedUntil( RouteConstant.dashboardScreen, (route) => false, arguments: 0, ); } try { Map? dataIdMap; if (data['dataId'] != null && data['dataId'] is String) { dataIdMap = jsonDecode(data['dataId']); } final postId = dataIdMap?['PostID']; if (postId == null) { navigateToDefault(); return; } // Initialize required controllers controllerInitialization(); // Navigate directly to SinglePostPage Get.to(() => SinglePostPage(postId: postId.toString(), tribeId: 0)); } catch (e) { navigateToDefault(); } } //.......................................................................................................................... //.......................................................................................................................... Future navigateToConnectionRequestScreen() async { isNotificationNavigation(true); try { if (Get.currentRoute == RouteConstant.splashScreen) { Get.offNamedUntil( RouteConstant.dashboardScreen, (route) => false, arguments: 0, ); } //.................................................. if (!Get.isRegistered()) { Get.put(RatingsReviewsController()); } if (!Get.isRegistered()) { Get.put(ChatController()); } if (!Get.isRegistered()) { Get.put(NotificationController()); } //................................................... // Ensure controller is registered if (!Get.isRegistered()) { Get.put(SocialConnectionController()); } final controller = Get.find(); controller.currentTab.value = "Invitations"; await controller.searchUsers(); Get.toNamed(RouteConstant.friendRequestScreen); } catch (e) { navigateToDefault(); } } //........................................................................................................ //........................................................................................................ Future navigateToFriendsScreen() async { isNotificationNavigation(true); try { if (Get.currentRoute == RouteConstant.splashScreen) { Get.offNamedUntil( RouteConstant.dashboardScreen, (route) => false, arguments: 0, ); } //.................................................. if (!Get.isRegistered()) { Get.put(RatingsReviewsController()); } if (!Get.isRegistered()) { Get.put(ChatController()); } if (!Get.isRegistered()) { Get.put(NotificationController()); } //................................................... // Ensure controller is registered if (!Get.isRegistered()) { Get.put(SocialConnectionController()); } final controller = Get.find(); controller.currentTab.value = "Friends"; await controller.searchUsers(); Get.toNamed(RouteConstant.friendRequestScreen); } catch (e) { navigateToDefault(); } } //.......................................................................................... //.......................................................................................... Future navigateToLiveStreamScreen() async { isNotificationNavigation(true); if (Get.currentRoute == RouteConstant.splashScreen) { Get.offNamedUntil( RouteConstant.dashboardScreen, (route) => false, arguments: 0, ); } //.................................................. if (!Get.isRegistered()) { Get.put(RatingsReviewsController()); } if (!Get.isRegistered()) { Get.put(ChatController()); } if (!Get.isRegistered()) { Get.put(NotificationController()); } //................................................... try { if (!Get.isRegistered()) { Get.put(GetLiveStreamsController()); } final controller = Get.find(); await controller.getSpecificStream(streamID: streamID.value); Get.toNamed(RouteConstant.singleLiveStreamScreen); } catch (e) { navigateToDefault(); } } //............................................................................................. Future navigateToViewTribeScreen(Map data) async { isNotificationNavigation(true); try { if (Get.currentRoute == RouteConstant.splashScreen) { Get.offNamedUntil( RouteConstant.dashboardScreen, (route) => false, arguments: 0, ); } //.................................................. if (!Get.isRegistered()) { Get.put(RatingsReviewsController()); } if (!Get.isRegistered()) { Get.put(ChatController()); } if (!Get.isRegistered()) { Get.put(NotificationController()); } if (!Get.isRegistered()) { Get.put(SocialConnectionController()); } //.......................................................... //.......................................................... //.......................................................... Map? dataIdMap; if (data['dataId'] != null && data['dataId'] is String) { dataIdMap = jsonDecode(data['dataId']); } final tribeId = dataIdMap?['TribeID']; // Check if TribeID exists and is not null/empty if (tribeId != null && tribeId.toString().isNotEmpty) { final socialConnectionController = Get.find(); // Navigate to TribeEchoboardPostListScreen with tribe and post IDs final tribeDetailsLoaded = await socialConnectionController .getSingleTribeDetails(tribeId: int.parse(tribeId)); if (tribeDetailsLoaded) { await Future.delayed(Duration(milliseconds: 100)); Get.to( () => TribeEchoboardPostListScreen( tribeId: int.parse(tribeId), tribeImage: socialConnectionController .singleTribeDetails .value! .data! .tribeImage!, tribeName: socialConnectionController .singleTribeDetails .value! .data! .tribeName!, ), arguments: 1, // Keep parent bottom nav at Echoboard Index ); scheduleMicrotask(() { controllerInitialization(); }); } else { // Failed to load tribe details customSnackbar( title: "Error", message: "Failed to load tribe details", duration: 2, ); Get.offAll(() => const DashboardScreen()); controllerInitialization(); } } } catch (e) { navigateToDefault(); } } //.......................................................................................... //.......................................................................................... void navigateToDefault() { if (SharedServices.isLoggedIn()) { controllerInitialization(); if (Get.currentRoute != RouteConstant.dashboardScreen) { // Get.toNamed(RouteConstant.dashboardScreen, arguments: 0); Get.offAll(() => const DashboardScreen()); } controllerInitialization(); } else { Get.offAll(() => LoginScreen()); } } controllerInitialization() { if (!Get.isRegistered()) { Get.put(NavigationController()); } if (!Get.isRegistered()) { Get.put(RatingsReviewsController()); } if (!Get.isRegistered()) { Get.put(EchoBoardController()); } if (!Get.isRegistered()) { Get.put(ChatController()); } if (!Get.isRegistered()) { Get.put(NotificationController()); } } }