diff --git a/lib/view_models/home_view_model.dart b/lib/view_models/home_view_model.dart index cfdf3fc..d9a3481 100644 --- a/lib/view_models/home_view_model.dart +++ b/lib/view_models/home_view_model.dart @@ -213,21 +213,29 @@ class HomeViewModel with ChangeNotifier { Future checkUnreadNotifications() async { final result = await _homeRepository.checkUnreadNotifications(); + switch (result) { case Ok>(): final response = result.value; - _hasUnreadNotification = response['success'] == true; + + final data = response['data']; + if (data is List && data.isNotEmpty) { + _hasUnreadNotification = true; + } else { + _hasUnreadNotification = false; + } break; + case Error>(): _hasUnreadNotification = false; - break; + break; } + notifyListeners(); } - void serUnreadNotificationFalse(){ + void serUnreadNotificationFalse() { _hasUnreadNotification = false; notifyListeners(); - } }