Once maggots infest your trash can, it is important to clean it out thoroughly. After removing the trash bag, fill the bottom of the trash can with boiling water. This kills any maggots that remain. Then, scrub the trash can thoroughly.
Clean the trash can with a mixture of water and vinegar to remove any odors and repel flies. Flies leave larvae that grow into maggots. Thoroughly dry out the trash can after cleaning, as maggots thrive in moist environments.
Bay leaves and mint oil are known to repel flies. Place a few bay leaves in the trash bag and spray the outside of the trash can with mint oil to help keep maggots away.