removeProfile method
Future<void>
removeProfile(
)
override
Implementation
@override
Future<void> removeProfile() async {
AppConfig.logger.d("removeProfile method Started");
try {
if(await ProfileFirestore().remove(userId: user.id, profileId: profile.id)) {
user.profiles.removeWhere((element) => element.id == profile.id);
if(user.profiles.isNotEmpty) {
profile = await userFirestore.updateCurrentProfile(user.id, user.profiles.first.id);
}
}
} catch (e) {
Get.snackbar(
CoreConstants.errorSigningOut.tr,
e.toString(),
snackPosition: SnackPosition.bottom,
);
Get.toNamed(AppRouteConstants.logout);
}
AppConfig.logger.i("removeProfile method Finished");
update();
}