Want to perform runtime type checking in Dart? The instanceof-operator is called is in Dart. The spec isn’t exactly friendly to a casual reader, so the best description right now seems to be http://www.dartlang.org/articles/optional-types/.
Here’s an example:
1 2 3 4 5 6 7 8 | class Foo { } main() { var foo = new Foo(); if (foo is Foo) { print("it's a foo!"); } } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.