There is a simpler version of what David has written.

**Claim.** Given a (1,1) form $\alpha$ representing the first Chern class of a holomorphic line bundle $[\alpha]=c_1(L)$, one can find a metric $h$ on $L$ such that its curvature is
$$
\Theta(L,h)=\frac{i}{2\pi}\alpha.
$$

Indeed, let $h_0$ be an arbitrary metric background on $L$ and $h=e^\phi h_0$ is the metric we are looking for. Then
$$\frac{i}{2\pi}\alpha=\Theta(L,h)=\Theta(L,h_0)+\partial\bar\partial\phi.$$

Existence of such $\phi$ immediately follows from $\partial\bar\partial$-lemma, applied to $d$-exact (1,1)-form $\frac{i}{2\pi}\alpha-\Theta(L,h_0)$.

**Remark.** This is not true in non-Kaehler case, for example on Hopf surface $M$ canonical bundle $K_M$ is topologically trivial, while it does not admit flat metric.

The claim has important consequence: line bundle $L$ is positive if and only if its first Chern class has positive $(1,1)$ representative.

See also https://mathoverflow.net/q/241687 where essentially the same claim is discussed.