
In an ideal/a perfect world
Hypothetical Context
The phrase often suggests a hypothetical or non-realistic situation used for comparison. 
Expressing Desire
Use it to express what you wish would happen, knowing that it's unlikely or impractical. 
Contrasting Reality
It's often used to contrast an imperfect current situation with a desirable, but unreachable, alternative. 