You cannot just use an electrical motor or a hydraulic pump to move the flaps. They are a means of providing the muscle required to move the flaps. To transfer the power extracted from either a hydraulic system or an electrical system to the flaps you would need something in between and in most aircraft this is achieved by using screw jacks.
Most large airplanes use hydraulics to move flaps because the flaps are too heavy and large for a practical electric motor to operate. Here, when the pilot moves the flap lever to the wanted detent, a unit called a Flap Power Unit (FPU) is powered up. The FPU is a hydraulic pump which receives input from the hydraulic system of the aircraft. It uses this hydraulic power to turn a drive shaft (torque tube), which then turns the screw jacks to extend and retract the flaps. Depending on the size of the aircraft there might be in excess of four screw jacks per wing.
In smaller airplanes like most Cessnas an electrical motor runs the screw jack. You would be able see the jack very clearly when the flaps are extended and during pre flight you have to check to see if the screw jack is stuck by giving it a little jolt. If it is moves you are good to go.
Author – Anas Maaz ( Airline Pilot )