How 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

Here’s an example:

class Foo { }

main() {
  var foo = new Foo();
  if (foo is Foo) {
    print("it's a foo!");

Leave a Comment