deleteAccount method

  1. @override
Future<void> deleteAccount({
  1. bool deleteNow = false,
})
override

Implementation

@override
Future<void> deleteAccount({bool deleteNow = false}) async {
  logger.finest('deleteAccount(${AccountManager.currentLoginUser.email})');
  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 !!!'));
  }
}