deleteAccountByUser method

  1. @override
Future<void> deleteAccountByUser(
  1. Map<String, dynamic> newUserData, {
  2. bool deleteNow = false,
})
override

Implementation

@override
Future<void> deleteAccountByUser(Map<String, dynamic> newUserData, {bool deleteNow = false}) async {
  logger.finest('deleteAccountByUser()');
  String userId = newUserData['userId'];
  if (deleteNow) {
    await HycopFactory.dataBase!.removeData('hycop_users', 'user=$userId').catchError(
            (error, stackTrace) =>
        throw HycopUtils.getHycopException(error: error, defaultMessage: 'removeData Error !!!'));
  } else {
    newUserData['isRemoved'] = true;
    await HycopFactory.dataBase!.setData('hycop_users', 'user=$userId', newUserData).catchError(
            (error, stackTrace) =>
        throw HycopUtils.getHycopException(error: error, defaultMessage: 'setData Error !!!'));
  }
}