The solar Lyα line is the strongest line in the ultraviolet waveband, and is greatly enhanced during solar flares. Here we present radiative hydrodynamic simulations of solar flares under different heating models, and calculate the response of this line taking into account non-equilibrium ionization of hydrogen and partial frequency redistribution. We find that in non-thermal heating models, the Lyα line can show a red or blue asymmetry corresponding to the chromospheric evaporation or condensation, respectively. The asymmetry may change from red to blue if the electron beam flux is large enough to produce a significant chromospheric condensation region. In the Lyα intensity lightcurve, there appears a dip when the change of asymmetry occurs. In thermal models, the Lyα line intensity peaks quickly and then falls, and the profile has an overall red asymmetry, which is similar to the profiles from heating by a soft electron beam. The Lyα profile shows a single red peak at the end of thermal heating, and the whole line is formed in a very small height range.