Maggots, the larval state of various flies of the order Diptera, eat decaying food and help break down organic material. According to Oregon State University, female soldier flies, Hermetia illucens, deposit eggs on nitrogen-rich decaying materials soon consumed by the larvae. Kitchen food scraps such as rotting fish, meat and eggs provide a food source. Like garden janitors, they clear detritus and help recycle nutrients into the soil.
The quantity of maggots can indicate an animal has died and become a food source. For example, a small animal such as a mouse or bird attracts a smaller number of maggots. A dead raccoon or cat can attract a larger number of maggots. According to Washington State University, the maggots as voracious consumers can reduce a dead body’s weight by 50 percent within a couple weeks. Climate can also impact the maggot's feeding. For example, the blue bottle fly, or Calliphora vomitoria, feeds on decayed organic material and carrion in the cooler months.
Maggots feed on the food source that has also provided their hatching environment. For example, the apple maggot fly inhabits apple tree foliage and fruit. Adult females pierce the apple skin to deposit eggs. The emerging maggots feed on the apple and leave their brown tracks. The blueberry maggot, Rhagoletis mendax Curran, is also a small, black fly whose larvae mature inside the blueberry. An infestation will render the blueberries soft and mushy.
Sunflower maggots, Strauzia longipennis or “picture-wing fly,” can infest and cause seed sterility in sunflowers. The female can deposit eggs in the flower’s stem tissue. According to the Government of Manitoba, the larvae consume the pith tissue and bore through the sunflower’s ovaries.