Modify your code as follows:

Code before migration:

void

dance

TargetPlatform

platform

switch

platform

case

TargetPlatform

android

// Do Android dance.

break

case

TargetPlatform

fuchsia

// Do Fuchsia dance.

break

case

TargetPlatform

iOS

// Do iOS dance.

break

case

TargetPlatform

macOS

// Do macOS dance.

break

Code after migration:

void

dance

TargetPlatform

platform

switch

platform