The Fe i 6173 Å line is widely used in the measurements of vector magnetic fields by instruments including the Helioseismic and Magnetic Imager (HMI). We perform non-local thermodynamic equilibrium calculations of this line based on radiative hydrodynamic simulations in a flaring atmosphere. We employ both a quiet-Sun atmosphere and a penumbral atmosphere as the initial one in our simulations. We find that, in the quiet-Sun atmosphere, the line center is obviously enhanced during an intermediate flare. The enhanced emission is contributed from both radiative backwarming in the photosphere and particle beam heating in the lower chromosphere. A blue asymmetry of the line profile also appears due to an upward mass motion in the lower chromosphere. If we take a penumbral atmosphere as the initial atmosphere, the line has a more significant response to the flare heating, showing a central emission and an obvious asymmetry. The low spectral resolution of HMI would indicate some loss of information, but the enhancement and line asymmetry are still kept. By calculating polarized line profiles, we find that the Stokes I and V profiles can be altered as a result of flare heating. Thus the distortion of this line has a crucial influence on the magnetic field measured from this line, and one should be cautious in interpreting the magnetic transients observed frequently in solar flares.