Let $f: \mathbb{R} \rightarrow \mathbb{R}$ be a function such that $$\displaystyle{f(f(x)) = \frac{x^2 - x}{2}\cdot f(x) + 2-x,}$$ for all $x \in  \mathbb{R}.$ Find all possible values of $f(2).$
1. Let \( P(x) \) be the assertion \( f(f(x)) = \frac{x^2 - x}{2} f(x) + 2 - x \).

2. Consider \( P(2) \):
   \[
   f(f(2)) = \frac{2^2 - 2}{2} f(2) + 2 - 2 = f(2)
   \]
   This implies that \( f(2) \) is a fixed point of \( f \), i.e., \( f(f(2)) = f(2) \).

3. Suppose \( f(u) = u \) for some \( u \). Then, substituting \( u \) into the functional equation:
   \[
   f(f(u)) = \frac{u^2 - u}{2} f(u) + 2 - u
   \]
   Since \( f(u) = u \), we have:
   \[
   u = \frac{u^2 - u}{2} u + 2 - u
   \]
   Simplifying this equation:
   \[
   u = \frac{u^3 - u^2}{2} + 2 - u
   \]
   \[
   2u = u^3 - u^2 + 4 - 2u
   \]
   \[
   4u = u^3 - u^2 + 4
   \]
   \[
   u^3 - u^2 - 4u + 4 = 0
   \]
   Solving this cubic equation, we find the possible values of \( u \) are \( u \in \{-2, 1, 2\} \).

4. Next, consider \( P(0) \):
   \[
   f(f(0)) = 2
   \]
   Let \( f(0) = a \). Then, \( f(a) = 2 \).

5. Now consider \( P(a) \):
   \[
   f(f(a)) = \frac{a^2 - a}{2} f(a) + 2 - a
   \]
   Since \( f(a) = 2 \), we have:
   \[
   f(2) = \frac{a^2 - a}{2} \cdot 2 + 2 - a
   \]
   \[
   f(2) = a^2 - a + 2 - a
   \]
   \[
   f(2) = a^2 - 2a + 2
   \]
   Since \( f(2) \) must be one of the fixed points, we have \( f(2) \in \{1, 2\} \).

6. If \( f(2) = 1 \):
   \[
   1 = a^2 - 2a + 2
   \]
   \[
   a^2 - 2a + 1 = 0
   \]
   \[
   (a - 1)^2 = 0
   \]
   \[
   a = 1
   \]
   Then, \( f(0) = 1 \) and \( f(f(0)) = f(1) = 1 \), which contradicts \( f(f(0)) = 2 \). Therefore, \( f(2) \neq 1 \).

7. Thus, the only remaining possibility is \( f(2) = 2 \).

The final answer is \( \boxed{2} \).