To make the sauce, melt butter over medium-Low heat. When melted, add flour and cook for 1 minute.
Whisk in the milk, salt, and pepper. Bring to a low boil then reduce heat and simmer until the sauce thickens.
ASSEMBLE
Preheat oven to 350°F. Spray a 9x13-inch casserole dish with non-stick spray.
Layer one layer of the raw potatoes with the onion in a 9x13-inch casserole dish. (You do not precook the potatoes.)
Pour 1/3 of the sauce over the potatoes. Repeat with two more layers of potatoes, onion, and sauce.
Top with grated cheddar cheese.
Bake at 350°F for 45 to 50 minutes. If the cheese on top starts to get too brown, loosely cover with aluminum foil. You can test for doneness with a fork. The potatoes will be tender when cooked through.
Allow the casserole to sit 10 minutes before servings.
Store leftovers covered in the refrigerator for 4 days.