Flats are necessary to eliminate vignetting and dust spots on your camera or CCD sensor when doing astrophotography.
I wrote an entire essay all about flats for my Swinburne astronomy course, but that's neither here nor there.
Here's a primitive but fairly effective way of getting a "dome flat."
All you need is your entire imaging train (telescope, flattener and filters if required, and CCD camera or DSLR), a sheet of white paper, and your friendly laptop.
The key things to remember are:
1. The telescope must be right up against the laptop screen (which should be displaying a blank white page, like a blank PowerPoint slide)
2. You should put a sheet of paper against the laptop screen to diffuse the light a bit
3. The CCD integration time (exposure time) must be more than 2 seconds. The reason for this is that at short integration times, all sorts of weird visual artifacts show up on the laptop screen, kind of like the "rolling picture" of old-time TV's when you see them in movies
4. Take at least four flats, rotating the entire telescope by 90 degrees between flats. Your software (I use DeepSkyStacker) should average these four flats to create a master flat.
A picture is worth a thousand words: