객체의 타입 확인
class ImmutablePoint {
final int x;
final int y;
const ImmutablePoint(this.x, this.y);
}
void main() {
var a = const ImmutablePoint(1, 1);
print('The type of a is ${a.runtimeType}');
}Last updated
class ImmutablePoint {
final int x;
final int y;
const ImmutablePoint(this.x, this.y);
}
void main() {
var a = const ImmutablePoint(1, 1);
print('The type of a is ${a.runtimeType}');
}Last updated
class ImmutablePoint {
final int x;
final int y;
const ImmutablePoint(this.x, this.y);
}
void main() {
var a = ImmutablePoint(1, 1);
print('a is ImmutablePoint? ${a is ImmutablePoint}');
dynamic b = ImmutablePoint(2, 3);
if (b is ImmutablePoint) {
print('b.x=${(b as ImmutablePoint).x}, b.y=${(b as ImmutablePoint).y}');
}
}