I don't know why people insist on using moth balls. They don't do anything. The reason you have maggots are flies are depositing larva into the garbage. The larva turns into maggots and then into flies. Keep the garbage can washed out after it is emptied and keep a lid tightl on the can. It may not cure the problem but will be a big help. Also a lot of garbage is fed to hogs. Moth balls is something you don't want in the garbage.
The easiest way is to pour some dry detergent in the bottom of your trash can before putting any garbage in it. The dry detergent repels the flies and the maggots.
We use plastic trash liners and never have the problem, but people may start going without now that money and plastics are becoming dear.
If you get maggots, it means you've left food in the bin for two or three days too long! This causes odours and is very unhygenic. The only way to stop this is to use smaller trash bags, and take them out more frequently, or alternatively, keep all food scraps in the freezer or fridge to stop flies laying eggs on them. The drawback for this method is that you need room, and also need to remember to take the rubbish out to the bin.
ThriftyFun is one of the longest running frugal living communities on the Internet. These are archives of older discussions.