Answer
$$y = - 4{e^{ - x}} + 2$$
Work Step by Step
$$\eqalign{
& \frac{{dy}}{{dx}} = - y + 2 \cr
& {\text{separate the variables}} \cr
& \frac{{dy}}{{ - y + 2}} = dx \cr
& {\text{integrate both sides}} \cr
& \int {\frac{{ - dy}}{{ - y + 2}}} = - \int {dx} {\text{ }} \cr
& {\text{ln}}\left| { - y + 2} \right| = - x + c \cr
& {\text{solve for }}y \cr
& {e^{{\text{ln}}\left| { - y + 2} \right|}} = {e^{ - x + c}} \cr
& - y + 2 = {e^c}{e^{ - x}} \cr
& - y = {e^c}{e^{ - x}} - 2 \cr
& y = \frac{{{e^c}{e^{ - x}}}}{{ - 1}} - \frac{2}{{ - 1}} \cr
& {\text{set }}\frac{{{e^c}}}{{ - 1}} = C \cr
& y = C{e^{ - x}} + 2 \cr
& {\text{the initial condition }}y\left( 0 \right) = - 2{\text{ implies that}} \cr
& - 2 = C{e^0} + 2 \cr
& - 2 = C + 2 \cr
& C = - 4 \cr
& {\text{so the solution of the initial value problem is}} \cr
& y = - 4{e^{ - x}} + 2 \cr} $$