Lemma 37.16.4. Let $S$ be a scheme. Let $f : X \to Y$ be a morphism of schemes over $S$. Assume
$X$ is locally of finite presentation over $S$,
$X$ is flat over $S$,
for every $s \in S$ the morphism $f_ s : X_ s \to Y_ s$ is flat, and
$Y$ is locally of finite type over $S$.
Then $f$ is flat. If $f$ is also surjective, then $Y$ is flat over $S$.