Let $(A,\mathfrak{m})$ be a regular local ring of dimension $1$. We set the usual notations: $K$ denotes the fraction field of $A$, $\kappa = A/\mathfrak{m}$ denotes the residue field and $\pi$ denotes a generator of $\mathfrak{m}$. For example, if $A = \mathbf{Z}_p$, then $\mathfrak{m} = (p)$, $K=\mathbf{Q}_p$, $\kappa = \mathbf{F}_p$ and we can take $\pi = p$.
I've heard that in this specific case, a homomorphism of (commutative) rings $A\to B$ is flat as soon as dim($B\otimes K $) = dim($B\otimes \kappa $) (i.e. as soon as the fibres have the same Krull dimension).
As pointed out in the comments, in this case, $B$ being flat over $A$ is equivalent to say that the map $B\to B\colon x\mapsto \pi.x$ is injective. Also note that equidimensionality is not a necessary condition (thanks @Mohan for pointing this out).
Answer: the assertion is false as stated, see the interesting counter-examples by @David Lampert and @Johann . Interestingly, the assertion is also false even if we assume that the fibres are smooth (the closed fibre is non-smooth in David's example, but the fibres are obviously smooth in Johann's example). Also note that by the miracle flatness theorem, it would suffice to require that $B$ is Cohen-Maccaulay.
After thoughts: In the end, the result I needed is the following:
Lemma: let $A\to B$ be as in the question. Assume that $B$ has equidimensional fibres, and furthermore that the closed fibre is irreducible and smooth. Finally, assume that there exists a closed embedding of $A$-schemes $\mathbf{A}_{A}^1\to \mathrm{Spec}B $ of the affine line over $A$ to $\mathrm{Spec}B$ (i.e. a surjective $A$-algebra map $B\to A[X]$). Then $B$ is flat over $A$.
Proof: Let $X$ be the (schematic) adherence of $\mathrm{Spec}(B_K)$ in $\mathrm{Spec}B$. By definition, $X$ is a flat $A$-scheme, and its closed fibre is non-empty because $\mathrm{Spec}B$ contains $\mathbf{A}_{A}^1$. Furthermore, $X_K = \mathrm{Spec}(B_K)$. Hence, $X_{\kappa}$ is a closed subscheme of $\mathrm{Spec}(B_{\kappa})$ of the same dimension than $\mathrm{Spec}(B_{\kappa})$. But this implies $X_{\kappa}=\mathrm{Spec}(B_{\kappa})$ because by assumption, $B_{\kappa}$ is a domain.