For over 50 years, gas flows have usually been investigated in computational fluid dynamics by using the Navier–Stokes–Fourier framework. Unfortunately, Navier–Stokes–Fourier fails to describe non-equilibrium states. To fill this gap, we give a thermodynamically consistent generalized hydrodynamic theory to develop a unified framework for both equilibrium and nonequilibrium gas flows. The critical step is that we extend the linear Rayleigh–Onsager dissipation to highly nonlinear dissipation to treat nonlinear irreversible thermodynamics. This extension fulfils the positive entropy generation criterion. The solutions of the generalized hydrodynamic theory are compared with experimental and/or particle-based direct simulation Monte Carlo data of the characteristic equilibrium and nonequilibrium gas flows. Good agreement is observed, as expected. The significance of this study is that it provides a unified framework for modelling nonequilibrium and equilibrium gas flows.