Zend certified PHP/Magento developer

Magento 2 checkout, I need to display or hide a shipping method depending on if a coupon code was entered and is valid. How can I do this?

I have a price rule attached to the flat rate shipping method as an option, and I want to intercept when the coupon is added, so that I can hide this flat rate method unless the coupon code matches the code value in the option. I have a model setup for retrieving the coupon code that is attached to the shipping method, but I don’t know how to hide, show and auto select a shipping method once I compare the coupon codes.

For example, I am not sure if it is possible to do what I want when I override MagentoCheckoutControllerCartCouponPost.

enter image description here