Ok so this situaltion isn't specificly addressed in the rules. So the dragon could stop, its not stated that it couldn't. Or the dragon could not stop, its not stated that it could either. I have hear Developers say the rules are designed to be "permisive and fun", and if there aren't specific rulings, to follow the idea that the game was designed for people to have fun and to use common sense in rulings. Right?
I think the Fly check is very permisable. The closer it is to the wall the harder the DC. I think it's how we would handle my character using a fly spell and trying to dodge a object that gets in my way. The dragon's fly ability isn't extraordanary. Its not any different that a bird's fly ability, right? It's ability is described as "clumsy".