From aa7b890ce43a74cf3cdefdb74df7bb76aba9d824 Mon Sep 17 00:00:00 2001 From: Lizandro Guarnizo <77708265+lizandrogd@users.noreply.github.com> Date: Wed, 22 Jul 2026 10:17:04 -0500 Subject: [PATCH] fix: notify immediately when isLoading=true in service fetch methods Without notifyListeners() after isLoading=true, the Consumer would briefly show stale data (or 'service not found') from a previous navigation before the API call completes. Co-Authored-By: Claude Sonnet 4.6 --- lib/providers/services_provider.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/providers/services_provider.dart b/lib/providers/services_provider.dart index cdacfcc..86dbef1 100644 --- a/lib/providers/services_provider.dart +++ b/lib/providers/services_provider.dart @@ -66,6 +66,7 @@ class ServicesProvider extends ChangeNotifier { getServiceForUser(String serviceId) async { try { isLoading = true; + notifyListeners(); final data = await _api.get('/services/$serviceId'); final map = data as Map; final servicio = Service.fromJson(map, map['id'] as String); @@ -90,6 +91,7 @@ class ServicesProvider extends ChangeNotifier { getServiceForProfessional(String serviceId) async { try { isLoading = true; + notifyListeners(); final data = await _api.get('/services/$serviceId'); final map = data as Map; final servicio = Service.fromJson(map, map['id'] as String);