Flats are calibration images taken against a featureless luminous object. They are used during the processing stages to calibrate the image data. The purpose is to removing dust motes and correct for uneven illumination across the field.
One method of obtaining flat files is to use a white t-shirt over the telescope and take an image of the light from the brightening sky in the morning. But the sky changes quickly so its difficult to get a set of good, even flats this way.
To get evenly illuminated flats regardless of what the sun is doing, I obtained some electro-luminescent (EL) panels and made my own flat boxes. These fit over the end of the telescope and put a measured, even amount of light into the telescope. The flat images taken this way create as many nearly identical flats as one needs.
They boxes I made are sort of crude. Basically they are just cardboard cutouts with EL panel taped to them. But they work well enough and with an adjustable power supply I was able to get the brightness to a good level for calibrating the camera and scope.
The end result is mostly a minimizing of the bright area in the middle of the images. Due to the nature of astrophotography, the center of the images tend to get the most light. So the centers look brighter. By using flat files, the processing software can determine just how much brighter the center is and then adjust the final image accordingly. The flat is basically just a photo of the brightness and the software then uses it to correct the data in the final images.
It's not perfect but it works pretty good. And it works quite a bit better than trying to fix the data after the fact using just predictive computer algorithms and logical data filters.