Detritivores are heterotrophs that obtain energy by feeding on detritus. Detritus is decomposing organic matter. They are major contributors to the ecosystem in which they belong, whether it is marine or terrestrial. Examples of detritivores include millipedes, woodlice, dung flies, slugs, and many terrestrial worms (as shown in this photograph).