Skip to content

Find the Invalid Switch Expression 🧐

Did you know?

One of the four snippets below is invalid (won’t compile).

Can you guess which one and why?


According to the language specification, you can’t begin a switch expression at the beginning of a line.

To solve this:

  • assign the expression to a variable (option 2)
  • wrap the expression with parenthesis (option 3)
  • return the expression (option 4)

Previous Next
6 steps to minimize your Firebase Bill Measuring execution time in Dart

Last update: 18 septembre 2023
Created: 18 septembre 2023