Preheat oven to 350°F (175°C). Line a 12-cup muffin tin with paper liners and set aside.
In a medium bowl, whisk together the flour, baking powder, and salt until evenly combined. Set aside.
In a large mixing bowl, beat the softened butter and sugar together with an electric mixer on medium-high speed for 3 minutes until light and fluffy.
Add the eggs one at a time, beating well after each addition. Mix in the vanilla and coconut extracts until combined.
With the mixer on low speed, alternate adding the flour mixture and coconut milk in three additions, beginning and ending with the flour. Mix just until no white streaks remain.
Gently fold in the shredded coconut with a spatula using no more than 10 strokes.
Divide the batter evenly among the prepared liners, filling each about two-thirds full. Bake for 18-20 minutes until a toothpick inserted in the center comes out clean and the tops spring back when lightly pressed.
Remove from the oven and let cool in the pan for 5 minutes, then transfer cupcakes to a wire rack to cool completely before frosting, about 45 minutes.
For the buttercream, beat the softened butter alone for 3 minutes until pale and creamy. Gradually add the powdered sugar one cup at a time, beating on low speed after each addition.
Add the heavy cream and coconut extract, then beat on high speed for 2 minutes until light and fluffy. Pipe or spread onto cooled cupcakes and top with toasted coconut flakes.