The median (or mean, they are almost identical for a flat) should be ideally between 0.5 and 0.8 - although you can make work with significantly darker ones (but avoid any risk to have overexposed ones!).
If it is too large, you have to shorten the exposure time. If it is too dark, you have to increase it. It is really that simple. Assuming that you take raw images, and so on...
In some case, if your image are completely overexposed, all pixels may be rejected by PI and appear black while, in fact, they are white.
Anyhow it would help if you stated what values you find with ImageStatistic and other information on your settings and camera, as it is difficult to guess what may be wrong otherwise.
-- bitli