In a sauce pan, whisk sugar, cocoa powder and heavy cream.
Cook over medium low heat, adding flour one tablespoon at a time, until the mixture has the consistency of pudding. Add a little more flour if needed.
If you get lumps while cooking, strain the pudding through a fine sieve immediately after cooking, while still hot.
Cool the mixture in the fridge until at room temperature.
Melt the chocolate in the microwave, in increments of 30 seconds, stirring after each interval. You can use dark chocolate or chocolate chips.
While the chocolate and the pudding are cooling, beat the butter until soft and fluffy.
Add vanilla and beat to combine.
Add the pudding and mix until combined and fluffy.
Finally, add the melted chocolate and whip until combined and fluffy.
Use to fill and frost a large cake or decorate about 24 cupcakes