the only reason flying boats fell out of use is the range of land based aircraft increased sufficiently that the ability to land and refuel on the water was no longer a strength, and the ability to have a streamlined fuselage is an efficiency and speed advantage over seaplanes.
That's two reasons. How about also the fact that more dry land runways were built as time went on.
You also need to consider the imperial background of the Great Powers. The British Empire (and the French and US Empires too) included large numbers of small islands in the Caribbean and the Pacific, each with a post office, a local government official, a bit of trade, sea around them, a jetty, and no airstrip. The flying boats were ideal for carrying the post and lighter trade items which got there faster than by the monthly (if you were lucky) cargo steam ship.
Once these places got their independence, typically in the 1950's, they were no longer an Imperial responsibility but neither could they support a commercial air service of any sort at the time. End of flying boats.