Short answer
It's not recommended. While a nursing dog needs extra calories, cake is a poor source and often contains ingredients toxic to dogs, like chocolate, raisins, or the sweetener xylitol. These toxins can pass into her milk and affect her puppies. Even a plain cake is high in sugar and fat, which can upset her stomach and reduce the quality of her milk. It's safest to stick to her regular, high-quality diet and consult your vet about any safe treat options during this sensitive time.
Cake — Food safety facts
Feed with care · Dogs · full breakdown on the linked food page
Check what is in it: chocolate, raisins and xylitol all appear in cakes and are all toxic.
The full verdict, portion guidance and serving notes are collected on the Cake food facts page.