Flies are scavengers, not decomposers; decomposers and scavengers work together to break down dead animals and plants. Flies, and other scavengers such as cockroaches, find and eat dead plants and animals, breaking them into bits as they are being eaten. Earthworms are also scavengers, but they only feed on plants.
Once scavengers eat what can be consumed from the dead animal or plant, decomposers take over. Most of them are microscopic, while others are visible to the naked eye, including fungi. Bacterial decomposers break down waste and meat from carnivores, while fungi prefer vegetables and fruits and actinolites break down dead plants and waste from herbivores.