B767's post is excellent.
I'm split, so here's my General Rule of Thumb: If the plane has a gear lever, don't fiddle with flaps on the runway. If it dosen't put 'em up, if you want.
Here's a related side-note story about squat switches:
I remember this girl on her commercial checkride at my old field. She was in a Cutlass, a 172RG. End of the chekride, everything good so far, all that was left was a soft field demonstration. She floats in and squeaks it on, nose high in the air-- perfect. Then she went to put the flaps up.
Now, at this point I should tell you that the Cutlass landing gear squat switch is located on the nose wheel, and that the gear lever is located perilously close to the flap lever, but that would wreck the story, wouldn't it?
"Too late! Too Late!" will be the cry, when the Flatulent Man passes you by!
The Cutlass's complex gear system, whose perfectly functioning squat switch was unfortunately still high above the runway, obligingly folded the mains aft and up, the nose pulled into its well, and the Cutlass settled onto its belly, stopping the engine and prop on the runway surface after less than 2 1/2 turns. Poor girl. Poor Cutlass.
On the other side of the coin, I've won many a landing contest in a plain-vanilla 172 by flipping the flap lever up just after touchdown. Also keeps things a bit more stable on the ground in gusty and cross-windy conditions. Useful stuff in spring at a place like
F50, if you've ever been there.
So my opinion is, like lots of other things in aviation, there's not always hard and fast rules. That's no fun anyway. Better to use knowledge, experience, and good judgment.