I couldn’t find an explanation for this expression with Google.
From what I’ve seen, it is followed by something undesirable, a negative outcome, and the meaning is “you shouldn’t have done that”.
And still, from a paper dictionary I’ve learned that it means something like “you should’ve known that it would be better to (do something)”, so it would be followed by a desirable outcome.
Could someone please explain how can I use it correctly?
You should’ve known it better. It means I wanted you to know it better but in fact, you didn’t. One more example, You should’ve gone to the party means it was advisable that you go to the party(should implies that the party is very good for you) but because of an indefensible reason, you couldn’t go to the party.