Implementing a potential problem with a current condition

I found the following post that seems to solve a similar type of problem
https://fenicsproject.org/olddocs/dolfin/2018.1.0/python/demos/singular-poisson/demo_singular-poisson.py.html
Unfortunately, the solution is in fenics instead of fenicsx, so I don’t know how to convert it. (I am a complete beginner and trying to teach myself this stuff.) So here is a comment I would like to make about the problem that is outlined, called the “singular Poisson problem”. If one were to choose any single point on the boundary and impose a Dirichlet condition at that point, the problem would no longer be singular. Now impose the condition that the average of u over the entire domain must be zero, and use that condition to solve for the unknown value in the Dirichlet condition. This is completely analogous to what I am trying to do in my problem. Apparently this can be handled in fenics, but how do we do it in fenicsx?

In the tutorial, they use something called a Krylov solver to impose the average condition. My method above seems more straightforward. The question is whether or not fenicsx is set up to handle my approach.

I just noticed that the singular Poisson problem was implemented in dolfinx in

Not sure if I can figure out how to modify this approach to solve the above problem with a current condition, but I will spend some time thinking about it and report my questions or answers.