Missing case clause error in dart switch case with enums Missing case clause error in dart switch case with enums dart dart

Missing case clause error in dart switch case with enums


It's so that you are forced to explicitly handle all use cases, which will lead to fewer bugs. You will either need to add a default which is the equivalent of 'when null or any unexpected enum value', or explicitly list all remaining enum values.

The best example is when you add a new value to an existing enum, several months after creating that enum, and then you cannot compile the app until you add that new value to all switch cases of that type (unless they were using default in which case they are already handled).