Steps
1. Preheat the oven to 350°F (180°C) and grease a small cake pan.
2. In a mixing bowl, combine flour, sugar, baking powder, baking soda, cinnamon, nutmeg, and salt.
3. In another bowl, whisk together grated carrots, vegetable oil, and egg.
4. Gradually add the dry ingredients to the wet ingredients, mixing until well combined. Fold in the chopped walnuts if using.
5. Pour the batter into the prepared cake pan and bake for 25-30 minutes or until a toothpick inserted in the center comes out clean.
6. Let the cake cool completely before frosting.