Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Does Dart not allow you to create static extension methods? #1896

Closed
gosoccerboy5 opened this issue Oct 10, 2021 · 2 comments
Closed

Comments

@gosoccerboy5
Copy link

When I type

extension on Object {
  static String foo() => "helo";
}
void main() {
  print(Object.foo());
}

in Dartpad or my local machine (Dart 2.13), I get a static analysis error:

Error: Method not found: 'Object.foo'.
  print(Object.foo());
               ^^^

What's going on? Am I not allowed to make static extension methods on a class?
If so, where does it mention this? I must have skipped over it somewhere.

@Levi-Lesches
Copy link

Nope, but it's being discussed: #42, #723.

@gosoccerboy5
Copy link
Author

Oh. Ok, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants