xxxxxxxxxx
void main() {
var variable = 42;
// Using runtimeType property
print(variable.runtimeType); // Output: int
// Using getType function
print(getType(variable)); // Output: int
}
Type getType<T>(T value) {
return T;
}
xxxxxxxxxx
class Foo { }
main() {
var foo = new Foo();
if (foo is Foo) {
print("it's a foo!");
}
}