Short answer: By not flying faster than the 104 did and adhering to the lessons learned.
Flutter first started to cause crashes in WW I when improved engine power and aerodynamics made a substantial rise in flight speed possible. Every time technological advance allowed higher speeds, flutter became an issue which was then solved both by trial and error and by analytics.
From NASA TM 4720:
The first recorded flutter incident was on a Handley Page O/400 twin
engine biplane bomber in 1916. The flutter mechanism consisted of a
coupling of the fuselage torsion mode with an antisymmetric elevator
This was easily fixed by removing one degree of freedom for the elevator: Initially, both sides could be moved independently, and by connecting them with a torsion tube the flutter mode could be avoided.
From control surface flutter in WW I, which was generally solved by the practice of balancing all control surfaces (something the early aircraft designers were oblivious of), flutter problems moved to primary surfaces from 1925 on. Again NACA TM 4720:
Air racers experienced many incidents of flutter from the mid-1920's
until the mid-1930's as attempts were made to break speed records
The first analytical testing was performed by von Schlippe in 1935 in Germany. He vibrated the aircraft at increasing speeds and measured the resulting amplitude. An increase in amplitude indicated a reduction in damping and imminent danger of flutter.
Typical amplitude over speed plot (from NACA TM 806, which is a direct translation of von Schlippe's work which was first published in Luftfahrtforschung Vol. 13 No. 2, February 1936)
With jets and their higher speeds, new types of flutter occurred. Again NACA TM 4720:
Supersonic speeds also produced a new type of flutter known as panel
flutter. Panel flutter involves constant amplitude standing or
traveling waves in aircraft skin coverings. This type of instability
could lead to abrupt fatigue failure, so the avoidance of panel
flutter is important.
Since maybe fifty years every new design must go through a static vibration test to check which elastic eigenfrequencies exist. Analytical methods are used to predict the (speed dependent) aerodynamic frequencies and the structure must be modified to remove any possibility of resonance. Next, the airframe is tested in flight at ever increasing speeds and with exciters at the tips of all surfaces (those can be like the vibration motor in your smartphone, only bigger, or, in the simplest of cases, the pilot moves the control surfaces). At increasing speeds, the exciters are run through a frequency sweep (typically from 5 to 60 Hz) and the resulting amplitude is measured by strain gages or accelerometers.
Below is a diagram (taken from NACA TM 4720) depicting the flutter test of the F-14. The F-14 and F-16 went through the same procedure to make sure flutter is no issue in operation. Modern fly-by-wire designs can even use their control surfaces for active flutter suppression.