There are many different theories about what it means if you dream of cake. Remember, it's important to take them all with a pinch of salt, as dream interpretation is not an exact science.
It's also worth noting that if you go to bed hungry, you're much more likely to dream of food. In this case, the dream might not have any symbolic meaning at all - you could just be hungry!
Dreams About Eating Cake
If you actually eat the cake in your dream, this could mean that company is coming; perhaps in the form of a new relationship or friendship.
You could also interpret this dream to mean that you're in need of comfort, or emotional and spiritual nourishment.
Really, I think it depends on the context of your dream, and what the cake is like; for example, a bad-tasting cake could represent disappointment and disenchantment, whereas a really good cake could be a symbol of something much more positive!
Dreams About Partially-Eaten Cake
The cake in these dreams is often thought to symbolise missed opportunities in your life. This doesn't mean that you actually have missed a good opportunity, but it might mean that you perceive it that way.
General Cake Dreams
Some people will say that the cake in your dream represents the sweeter things in life, like happiness and success. Others believe that cake can symbolise the rewards of hard work, or a need to share.