In a medium saucepan (off heat), whisk together the sugar, cornstarch, and cocoa powder.
Slowly whisk in the milk until smooth.
Cook over medium heat, whisking constantly, until thickened and gently bubbling. Whisk 30–60 seconds more for a smooth, glossy texture.
Remove from heat and whisk in the dark chocolate until melted and fully smooth.
Pour into 3 serving cups.
Press plastic wrap directly onto the surface to prevent skin.
Chill for about 2 hours, until set.
Top with chopped walnuts (optional) and serve.