Skip to content

Instantly share code, notes, and snippets.

@Animeshz
Last active February 15, 2021 15:10
Show Gist options
  • Save Animeshz/b3df98f58631f6d587bd94fdb95fdd90 to your computer and use it in GitHub Desktop.
Save Animeshz/b3df98f58631f6d587bd94fdb95fdd90 to your computer and use it in GitHub Desktop.
class A {}
class B extends A {}
class C extends A {}
void main() {
List<A> animals = [B()];
List<C> cats = [];
print("reached here");
try {
cats.add(animals.first);
} catch (e) {
print('"runtime" error occured in addition, not compile time');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment