initProfile method
Implementation
void initProfile() async {
if (FirebaseAuth.instance.currentUser == null) {
WidgetsBinding.instance.addPostFrameCallback((_) {
Get.offAllNamed(Routes.LOGIN);
});
return;
}
isEditingInformation.value = false;
isEditingPassword.value = false;
currentPasswordController.clear();
newPasswordController.clear();
confirmPasswordController.clear();
try {
await authenticationController.getUserProfile();
final profile = authenticationController.userProfileModel.value.data;
userFirstNameController.text = profile?.firstName ?? '';
userLastNameController.text = profile?.lastName ?? '';
userEmailController.text = profile?.email ?? "";
userPhoneController.text = profile?.phone ?? "";
countryCode.value = profile?.countryCode ?? "";
} catch (e) {
log('Error loading profile: ${e.toString()}');
}
}