dart check type code example
Example 1: dart check type of variable
class Foo { }
main() {
var foo = new Foo();
if (foo is Foo) {
print("it's a foo!");
}
}
Example 2: flutter type check
bool check(dynamic object) => object is T;
class Foo { }
main() {
var foo = new Foo();
if (foo is Foo) {
print("it's a foo!");
}
}
bool check(dynamic object) => object is T;