delete method

Future<void> delete()

Implementation

Future<void> delete() async {
  setBusy(true);

  try {
    await _authenticationService.deleteUserAccount();
  } on ApiException catch (e) {
    _dialogService.showDialog(
      BasicDialog(
        title: "Error",
        description:
            "Sorry, something went wrong!\nPlease try again. ${e.message}",
      ),
    );
  }

  await _dialogService.showDialog(BasicDialog(
    title: "All done!",
    description: "Your account has now been deleted.",
  ));
  await _analyticsService.logUserAccountDeleted();
  logout();
  setBusy(false);
  notifyListeners();
}