import 'dart:math' as math; | |
class Circle { | |
final double radius; | |
Circle(this.radius); | |
} | |
test1(dynamic x) => switch (x) { | |
Circle(radius: var r) when r > 0 => r * r * math.pi, | |
_ => null | |
}; | |
dynamic Function(dynamic)? captured; | |
test2(dynamic x) => switch (x) { | |
[int a, int b] | |
when (captured = (x) { | |
return a + b; | |
}) is dynamic => | |
captured!(a = b), | |
[String a, String b] | |
when (captured = (x) { | |
return a + b; | |
}) is dynamic => | |
captured!(a = b), | |
_ => null | |
}; | |
test3(dynamic x) {} | |
main() {} | |
expectEquals(x, y) {} |