Follow the lens…
Not all flashes has the ability to zoom, but some do, like speedlites from Godox or Yongnuo. The point is to send the light in the same direction as the lens is “looking”. Sending the light wide if the lens is zoomed in at a narrow field of view does not make much sense, and vice versa.
The flash can follow the lens on the camera if in TTL mode and adapt the same zoom as the lens, provided it stays within the range the flash can follow (typically 20-200 mm). Notice that if the flash has the built in wide angle diffuser engaged, then the zoom is locked in its widest position.
You can also set the zoom manually just like you can set the flash power manually – in the images above I did just that to illustrate the difference between the two flash zoom positions without changing the zoom on the lens (the Nikon 24-70/4 S by the way).
Related reading
Flash photography – why bother?
What is the wide-angle diffuser in your flash?