How to prevent click event propagation


When using a material button inside a container and you click on the material button, it triggers the material button event handler, but then it propagates up to the container. What is the recommended way to stop the event from propagating beyond the material button?


event.stopPropagation() will stop it propagating.

event.preventDefault() stops any native action the event would have.

Answered By – Ted Sander

Answer Checked By – Cary Denson (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *