Fix professionals list never loading when user has no city

updateCity skipped getProfessionals() when both _city and the incoming
city were null (null != null = false). Added _initialized flag so the
first call always triggers the load regardless of city value.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-07-12 20:14:59 -05:00
co-authored by Claude Sonnet 4.6
parent 4698454cfc
commit 9da159f287
+4 -1
View File
@@ -6,10 +6,13 @@ class ProfessionalsProvider extends ChangeNotifier {
List<UsuarioProfesional> professionals = [];
bool isLoading = true;
String? _city;
bool _initialized = false;
final _api = ApiService.instance;
void updateCity(String? city) {
if (_city != city) {
// Always load on first auth event; afterwards only reload when city changes.
if (!_initialized || _city != city) {
_initialized = true;
_city = city;
getProfessionals();
}