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 = [];
|
List<UsuarioProfesional> professionals = [];
|
||||||
bool isLoading = true;
|
bool isLoading = true;
|
||||||
String? _city;
|
String? _city;
|
||||||
|
bool _initialized = false;
|
||||||
final _api = ApiService.instance;
|
final _api = ApiService.instance;
|
||||||
|
|
||||||
void updateCity(String? city) {
|
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;
|
_city = city;
|
||||||
getProfessionals();
|
getProfessionals();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user