Suppose $A,B$ are local rings and $f:A\to B$ is a local ring homomorphism. Let $\hat{A}$ and $\hat{B}$ be the completions of $A,B$ at their maximal ideals and $\hat{f}$ be the induced map between completions. Is it true that the flatness of $f$ and $\hat{f}$ are equivalent?
I would expect this to be true based on some sort of way to write the functors $B\otimes_A$ and $\hat{B}\otimes_{\hat{A}}$ as compositions of each other and the extension of scalars $\hat{A}\otimes_A$, but I can't figure out how to go from $\hat{f}$ back to $f$.