I'm an Android developer trying to learn flutter. I'm stuck in checking whether an object is an instance of a class (A stateful or stateless widget) or not.
In Java we use like
if (object instanceOf MyClass) {
// object is an instance of MyClass
} else {
// object is not an instance of MyClass
}
But i don't know how to do it in flutter.
So far I've tried,
if (object is MyClass) {
// object is an instance of MyClass
} else {
// object is not an instance of MyClass
}
but this is always false.
I've seen another possible way of doing it new isInstanceOf<MyClass>()
which is available in package:matcher/matcher.dart
package but i don't know how to implement it properly.
Any help would be great. Thanks in advance.