While with a student doing pattern work in a 182RG, I ran the same procedure that I always do and quickly learned the error of my ways. We touched down, rolled out, set flaps back to 10, verified they were in transition, and powered up for the go. As we rotated and ran out of usable runway, I could tell we weren't climbing well. I look back outside and realize the flaps are stuck down between 40 and 30 degrees. I tell the student I have the airplane, lower the nose to maintain our airspeed and immediately get the gear up. We are climbing at about 65 knots, and about 100 fpm, with full power. Since we were climbing, I decided not to try to mess with the flaps until at a safe altitude in case they decided to come up all at once. I limped the airplane onto downwind as we were climbing through 500 feet. I recycled the flap lever two or three times and they came right up without any problems. Moral of the story, before going to full power, make sure the flaps are set rather than just verifying they are moving in the right direction. I know many pilots who are guilty of this and I just want to share my experience so that someone else can avoid it altogether.