We present spectroscopic metallicities of individual stars in seven gas-rich dwarf irregular galaxies ( dIrrs ) , and we show that dIrrs obey the same mass–metallicity relation as the dwarf spheroidal ( dSph ) satellites of both the Milky Way and M31 : Z _ { * } \propto M _ { * } ^ { 0.30 \pm 0.02 } . The uniformity of the relation is in contradiction to previous estimates of metallicity based on photometry . This relationship is roughly continuous with the stellar mass–stellar metallicity relation for galaxies as massive as M _ { * } = 10 ^ { 12 } ~ { } M _ { \sun } . Although the average metallicities of dwarf galaxies depend only on stellar mass , the shapes of their metallicity distributions depend on galaxy type . The metallicity distributions of dIrrs resemble simple , leaky box chemical evolution models , whereas dSphs require an additional parameter , such as gas accretion , to explain the shapes of their metallicity distributions . Furthermore , the metallicity distributions of the more luminous dSphs have sharp , metal-rich cut-offs that are consistent with the sudden truncation of star formation due to ram pressure stripping .