Check out example codes for "dart switch with classes". It will help you in understanding the concepts better.

Code Example 1

class Foo {
  Foo getAnother(Foo foo) {
    switch (foo.runtimeType) {
      case Bar:
        return new Bar();
      case Baz:
        return new Baz();
    }
    return null;
  }
}

Learn ReactJs, React Native from akashmittal.com