\(\left(x-1\right)\left(x+2\right)=\left(x-2\right)^2\)
\(\Rightarrow\left(x-1\right)x+\left(x-1\right)2=\left(x-2\right)\left(x-2\right)\)
\(\Rightarrow x^2-x+2x-2=\left(x-2\right)x-\left(x-2\right)2\)
\(\Rightarrow x^2+x-2=x^2-2x-\left(2x-4\right)\)
\(\Rightarrow x^2+x-2=x^2-2x-2x+4\)
\(\Rightarrow x^2+x-x^2+2x+2x=4+2\)
\(\Rightarrow5x=6\)
\(\Rightarrow x=\frac{6}{5}\)