If the symmetry is such that you can find a surface on which the electric field is constant, then evaluating the electric flux can be done by
Figure 20.17 shows a spherical Gaussian surface and a charge distribution. When calculating the flux of electric field through the Gaussian surface, the electric field will be due to