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

Arrow function without brackets for a single parameter #51621

Closed
gmb119943 opened this issue Mar 3, 2023 · 3 comments
Closed

Arrow function without brackets for a single parameter #51621

gmb119943 opened this issue Mar 3, 2023 · 3 comments
Labels
closed-duplicate Closed in favor of an existing report

Comments

@gmb119943
Copy link

gmb119943 commented Mar 3, 2023

Is it possible in one of the next versions of dart to implement a shorthand syntax for => functions?

The abbreviation is that for functions => with one parameter, it is not necessary to use parentheses around the parameter.
Much like in javascript.

void main() {
  var list1 = [1, 2, 3];

  list1.map((i) => i + 1); // current version
  list1.map(i => i + 1);   // a new version
}
@mnordine
Copy link
Contributor

mnordine commented Mar 3, 2023

You should put language stuff in https://github.com/dart-lang/language

@mnordine
Copy link
Contributor

mnordine commented Mar 3, 2023

Something like that exists: dart-lang/language#320

@lrhn lrhn added the closed-duplicate Closed in favor of an existing report label Mar 3, 2023
@lrhn
Copy link
Member

lrhn commented Mar 3, 2023

I'll defer to the existing language issue.

@lrhn lrhn closed this as completed Mar 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-duplicate Closed in favor of an existing report
Projects
None yet
Development

No branches or pull requests

3 participants