Preheat the oven to 400°F. Lightly grease the 7x5-inch baking dish.
Thinly slice the 1 large russet potato (about 12 oz) into even slices. Divide the slices into two roughly equal piles.
Take the 1/4 onion, halve it root-to-tip, then thinly slice the halves.
Arrange half of the potato slices in an even layer in the prepared dish. Top the potatoes with all of the sliced onion, spreading it evenly.
Sprinkle half of the 1/4 teaspoon salt and half of the 1/8 teaspoon pepper evenly over the onions. Sprinkle the heaping teaspoon of all-purpose flour evenly over the onions. Scatter half of the diced cold butter and sprinkle half of the shredded Cheddar over this layer.
Add the remaining potato slices in an even layer over the first layer. Sprinkle the remaining salt and pepper, dot with the remaining diced butter, and sprinkle the remaining shredded Cheddar on top.
Pour the 1/3 cup milk and 1/3 cup heavy cream evenly over the potatoes and cheese.
Place a sheet of foil or a baking sheet on the oven’s bottom rack to catch any bubbling over. Put the gratin on the center rack and bake for 40 to 60 minutes, until the potatoes are fork-tender and the top is bubbly.
Remove from the oven and let the gratin rest for five minutes before serving.