We are given the differential equation
\[
\frac{du}{dx}=\frac{-xu^{2}}{2+x^{2}u}.
\]
We rearrange it to check if it is exact. Write it as
\[
(2+x^{2}u)\,du + xu^{2}\,dx = 0.
\]
This takes the form
\[
M(x,u)\,dx + N(x,u)\,du = 0,
\]
where
\[
M = xu^{2}, \qquad N = 2 + x^{2}u.
\]
Step 1: Check exactness.
Compute partial derivatives:
\[
\frac{\partial M}{\partial u} = 2xu, \qquad
\frac{\partial N}{\partial x} = 2xu.
\]
Since both are equal, the equation is exact.
Step 2: Integrate $M$ with respect to $x$.
\[
\int xu^{2}\,dx = \frac{1}{2}x^{2}u^{2} + f(u).
\]
Step 3: Differentiate with respect to $u$.
\[
\frac{\partial}{\partial u}\left(\frac{1}{2}x^{2}u^{2} + f(u)\right)
= x^{2}u + f'(u).
\]
This must equal $N = 2 + x^{2}u$, therefore
\[
f'(u) = 2 \quad \Rightarrow \quad f(u)=2u.
\]
Step 4: Write the solution.
\[
\frac{1}{2}x^{2}u^{2} + 2u = C.
\]
Final Answer: $\frac{1}{2}x^{2}u^{2}+2u=\text{constant}$