Get your
own
website
Change Orientation
Ctrl+Alt+O
Change Theme
Ctrl+Alt+D
Change Language
Go to Spaces
Ctrl+Alt+P
abstract class Shape {} class Circle extends Shape {} class Square extends Shape {} String name(Shape shape) { return switch (shape) { Circle() => 'Circle', Square() => 'Square', }; } void main() { print(name(Circle())); }
main.dart:8:18: Error: The type 'Shape' is not exhaustively matched by the switch cases since it doesn't match 'Shape()'.
- 'Shape' is from 'main.dart'.
Try adding a wildcard pattern or cases that match 'Shape()'.
return switch (shape) {
^