Dora, welcome to the Back To Nature world of the composting toilet!   If it isn't fly larvae, it's gnat larvae, especially in the summer.    There are a lot of insects in nature that break down all the animal waste on the ground and they know how to find it.  
 
 I'm really sorry to say, but it is a constant job.  Fly and gnat larvae can be in the mowed weeds if you use that for the covering layers, they can be in house plant soil, or they can just sneak in the door.  
 
 I keep sticky fly paper hanging nearby and it catches whatever comes out of there.  Sometimes it's surprising how many there are, even when there's no sign of them elsewhere.
 
 I don't 
compost in the toilet.  I put a sub container in the toilet and empty it every 4 days in the summer, compost it outside.   Then there isn't time for the larvae to hatch.
 
 One thing I am trying, and I don't have reliable results yet, is baking soda sprinkled over solids immediately, then covered with mowed weeds or sawdust.  Then to counteract the alkalinity of the baking soda, I add an equal amount of mowed weeds to the toilet amount, which will  add some acidity of their own.
 
 The reason I am trying baking soda is that in my tall grass at my rural place there are little bugs that I get itchy bites around my ankles in the summer, even when I wear rubber boots.  So I put baking soda in the boots, which is nice for a lot of reasons, and it seems to stop tiny bugs that get into the boots.  So I am hoping that it works in the composting toilet, too.  I would say so far there's less than usual, but they are not completely gone.  I may have to up the sprinkle of baking soda.  If that makes a big difference, then I'll have to do more to add acidity back into the outdoor composting toilet container.
 
Mediterranean climate, hugel trenches, fabulous clay soil high in nutrients, self-watering containers with hugel layers, keyhole composting with low hugel raised beds, thick Back to Eden Wood chips mulch (distinguished from Bark chips), using as many native plants as possible....all drought tolerant.