Does Transcranial Direct-Current Stimulation (tDCS) enhance cognitive function? From the book "The future is faster than you think" by Peter Diamandis, Steven Kotler:

“Consider the nine-dot problem, a classic test of creative problem-solving. Connect nine dots with four lines in ten minutes without lifting your pencil from the paper. Under normal circumstances, fewer than 5 percent of the population can pull this off. In a study run at the University of Sydney in Australia, none of their test subjects did. But then the researchers took a second group of subjects, and used transcranial direct stimulation to artificially mimic many of the changes produced during flow. What happened? Forty percent solved the problem—a record result.”

What is the current scientific consensus on this question?

This appears to be the study mentioned:
Brain stimulation enables the solution of an inherently difficult problem
https://www.sciencedirect.com/science/article/abs/pii/S0304394012003618

An APA reference to the study was requested.
Here is one such reference:
Using transcranial direct current stimulation to enhance creative cognition: Interactions between task, polarity, and stimulation site.
https://psycnet.apa.org/record/2017-24133-001
There is no consensus on this question. This technique is relatively new, and has not been widely used so far. I know of one paper (below) that used this technique alongside intra-cortical recordings and do report convincing effects on LFPs (the overall activity of a local area) and behavior of non-human primates, but not on individual neurons. So this technique does have the potential to modulate brain activity on behaving humans.

For the paper you cite specifically, I do not know whether it is true or not. But solving the 9-dots problem is a hard and unspecified problem that presumably involves the participation of millions of neurons all over the brain. That you could improve performance so much by applying such a simplistic pattern of stimulation is more than highly dubious (in my opinion even laughable). It may be true, but if you asked me to bet I would feel very comfortable betting a large sum of money that such a result would not be replicated in a rigorous, large-scale, double-blind study.

As for consensus, you'll find multiple meta-analyses and reviews (example below) arguing that tDCS has no effect whatsoever on behavior. It doesn't mean there aren't studies reporting real effects in the mix, but the vast majority of studies I have seen so far were very dubious.

Krause, M. R., Zanos, T. P., Csorba, B. A., Pilly, P. K., Choe, J., Phillips, M. E., ... &amp; Pack, C. C. (2017). Transcranial direct current stimulation facilitates associative learning and alters functional connectivity in the primate brain. Current Biology, 27(20), 3086-3096.

Horvath, J. C., Forte, J. D., &amp; Carter, O. (2015). Quantitative review finds no evidence of cognitive effects in healthy populations from single-session transcranial direct current stimulation (tDCS). Brain stimulation, 8(3), 535-550.