Is compressed air effective to clean a 2018 MacBook Pro keyboard which displays repeated keypresses?
The 'Butterfly' keyboard Apple uses is known to be faulty and many users experience problems with it. A quick google search for 'Butterfly Keyboard Problems' will show you the scale of this issue. The solution you found may work, but I would strongly suggest taking it back to Apple, since its still under warranty it should be free and it will likely prolong the lifespan of your Macbook.