The rheology of dense flows of hard particles is singular near the jamming threshold where flow ceases, both for aerial granular flows dominated by inertia, and for over-damped suspensions. At the same time, the length scale characterizing velocity correlations appears to diverge at jamming. We introduce a theoretical framework that proposes a potentially complete scaling description of stationary flows of frictionless particles. We compare our predictions with the empirical literature, as well as with new numerical data. Overall we find a very good agreement between theory and observations. Finally, we use simulations of frictional inertial flow to outline the regime of the phase diagram where the theory holds, and show where friction adds new physics.