The Flash is still limited to being on a planet (usually) and has an around average human lifespan.
Yoda is the Grandmaster of the Jedi Order, an organization of sentient beings that wield a mysterious power known as "the Force." The Force enables many abilities, the most relevant here being that of precognition-- Force adepts are able to sense danger before it comes. The Jedi Order spans an entire galaxy, and Yoda's species lives for around one standard millennium. As a pacifist, Yoda outlives Flash and waits for him to die on another planet. Flash is unable to search an entire galaxy, and even if he gets close, Yoda can simply move to another star system.