Skip to content

Instantly share code, notes, and snippets.

@osa1
Last active November 30, 2022 13:33
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 osa1/dbdc827b31a55e35ad0a20ae5f5c5594 to your computer and use it in GitHub Desktop.
Save osa1/dbdc827b31a55e35ad0a20ae5f5c5594 to your computer and use it in GitHub Desktop.
Strange Dart 4
class A {
void f() {
print('A.f called');
}
}
class B implements A {
void f({int test}); // optional non-nullable with no default value, also not a valid override
// `f` above is not valid without a `noSuchMethod`
noSuchMethod(Invocation invocation) {
print('B.noSuchMethod');
}
}
void main() {
B().f(); // prints "B.noSuchMethod"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment