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:
co-authored by
Claude Sonnet 4.6
parent
4698454cfc
commit
9da159f287
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user