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 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-07-22 10:17:04 -05:00
co-authored by Claude Sonnet 4.6
parent ea442aafa7
commit aa7b890ce4
+2
View File
@@ -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<String, dynamic>;
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<String, dynamic>;
final servicio = Service.fromJson(map, map['id'] as String);