When a free Fermi gas on a lattice is subject to the action of a linear potential it does not drift away, as one would naively expect, but it remains spatially localized. Here we revisit this phenomenon, known as Stark localization, within the recently proposed framework of generalized hydrodynamics. In particular, we consider the dynamics of an initial state in the form of a domain wall and we recover known results for the particle density and the particle current, while we derive analytical predictions for relevant observables such as the entanglement entropy and the full counting statistics. Then, we extend the analysis to generic potentials, highlighting the relationship between the occurrence of localization and the presence of peculiar closed orbits in phase space, arising from the lattice dispersion relation. We also compare our analytical predictions with numerical calculations and with the available results, finding perfect agreement. This approach paves the way for an exact treatment of the interacting case known as Stark many-body localization.