how to check data type in dart code example
Example 1: how to find the type of object in dart
var x = [32,4424];
print(x.runtimeType);
O/P:-
JSArray<int>
Example 2: dart check type of variable
class Foo { }
main() {
var foo = new Foo();
if (foo is Foo) {
print("it's a foo!");
}
}
Example 3: check data type flutter
selector.runtimeType // return data type of the variable
Example:
if (selector.runtimeType == int) print("Hello")