Set a saucepan over medium-high heat.
Add the butter and let it melt slightly, then add the onions.
Cook onions until they are translucent and are beginning to take on a bit of colour, about 5 minutes.
Add the crushed garlic and cook for 2 minutes more.
Sprinkle the all purpose flour over the top and cook for about 1 minute, stirring constantly.
Add the milk and stir well to incorporate the flour. Stir constantly to avoid burning the milk.
When the sauce begins to thicken, after 1-2 minutes, add the red pepper flakes, corn kernels, and Parmesan.
Reduce heat to medium-low and allow the sauce to cook for 3-5 minutes more, so the sauce is thick (it should coat the back of a spoon) and the corn is heated through.
Season with salt and pepper, and remove from the heat.
Toast bread, and butter, if desired.
Spoon the hot corn over toast, and serve immediately.