Cans of sealant / inflation gas probably work when the tyre has a small puncture. But not if the tyre is damaged after being run flat for a short distance while finding a safe place to stop.
A spare wheel ( and the knowledge / ability to change a wheel in safety ) is the far better option.