deleteAccount method
Future<void>
deleteAccount(
{ - bool deleteNow = false,
})
override
Implementation
@override
Future<void> deleteAccount({bool deleteNow = false}) async {
logger.finest('deleteAccount(${AccountManager.currentLoginUser.email})');
if (!AccountManager.currentLoginUser.isLoginedUser) {
throw HycopUtils.getHycopException(defaultMessage: 'not logined user !!!');
}
String userId = AccountManager.currentLoginUser.userId;
if (deleteNow) {
await HycopFactory.dataBase!.removeData('hycop_users', 'user=$userId').catchError(
(error, stackTrace) =>
throw HycopUtils.getHycopException(error: error, defaultMessage: 'removeData Error !!!'));
} else {
Map<String, dynamic> newUserData = {};
newUserData.addAll(AccountManager.currentLoginUser.getValueMap);
newUserData['isRemoved'] = true;
await HycopFactory.dataBase!.setData('hycop_users', 'user=$userId', newUserData).catchError(
(error, stackTrace) =>
throw HycopUtils.getHycopException(error: error, defaultMessage: 'setData Error !!!'));
}
}