Skip to content

Instantly share code, notes, and snippets.

@martinrybak
Created March 25, 2020 15:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martinrybak/a35c51311bc0bb9145002aecbd09f2c1 to your computer and use it in GitHub Desktop.
Save martinrybak/a35c51311bc0bb9145002aecbd09f2c1 to your computer and use it in GitHub Desktop.
Dart inheritance weirdness
class Foo {}
class Bar extends Foo {}
void acceptsBar(Bar bar) {}
void main() {
Foo foo = Foo();
acceptsBar(Foo()); // ERROR
acceptsBar(foo); // NO ERROR ??
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment