We report on the first measurement of the astrophysical neutrino flux using particle showers (cascades) in IceCube data from 2010 -- 2015. Assuming standard oscillations, the astrophysical neutrinos in this dedicated cascade sample are dominated (∼90%) by electron and tau flavors. The flux, observed in the sensitive energy range from 16TeV to 2.6PeV, is consistent with a single power-law model as expected from Fermi-type acceleration of high energy particles at astrophysical sources. We find the flux spectral index to be γ=2.53±0.07 and a flux normalization for each neutrino flavor of ϕastro=1.66−0.27+0.25 at E0=100TeV, in agreement with IceCube's complementary muon neutrino results and with all-neutrino flavor fit results. In the measured energy range we reject spectral indices γ≤2.28 at ≥3σ significance level. Due to high neutrino energy resolution and low atmospheric neutrino backgrounds, this analysis provides the most detailed characterization of the neutrino flux at energies below ∼100TeV compared to previous IceCube results. Results from fits assuming more complex neutrino flux models suggest a flux softening at high energies and a flux hardening at low energies (p-value ≥0.06). The sizable and smooth flux measured below ∼100TeV remains a puzzle. In order to not violate the isotropic diffuse gamma-ray background as measured by the Fermi-LAT, it suggests the existence of astrophysical neutrino sources characterized by dense environments which are opaque to gamma-rays.