Requst: Optional parentheses for one argument arrow function
Arrow functions, or lambdas as some languages call it, are frequently used in dart, even more so in the Flutter framework. Most of these arrow functions only contain one argument. At the language's current standing, if I were to write a `forEach` loop on a List, I would have to do something like this: ```dart void main(List<String> args) { List list = [1,2,3,4]; list.forEach((item) => /* Do something item */); } ``` `forEach` is just one of the many places that an arrow function is frequently used. As you can see, the parentheses around the `item` make the whole arrow function a little awkward to write and also read. I propose the following change: make the parenthensis around one argument arrow functions optional, permitting writing code as such: ```dart void main(List<String> args) { List list = [1,2,3,4]; list.forEach(item => /* Do something item */); } ``` This makes the code much cleaner to read and to write.
Posted by architkithania on Apr 18, 2019, 3:28 PM
Tags
Related issues
- struct's lifetime requirements can be bypassed via covariant field assignment
- Proposal to Reorganize the Moderation Team and Review Moderation Policies
- Progressive FPS degradation appears to be related to dota2.com — blocking the domain prevents the performance loss
- proposal: container/...: generic collection types
- Better Custom Endpoint BYOK
- A concrete policy for backward compatibility until Godot 5.0
Raise real-world problems, find people facing the same issue, and discuss solutions.4,000 issues0 comments
github (Other)
struct's lifetime requirements can be bypassed via covariant field assignment
Proposal to Reorganize the Moderation Team and Review Moderation Policies
Progressive FPS degradation appears to be related to dota2.com — blocking the domain prevents the performance loss
proposal: container/...: generic collection types
Better Custom Endpoint BYOK
A concrete policy for backward compatibility until Godot 5.0
New MTP models not supported
Tracking: 429 / Capacity Issues
Requst: Optional parentheses for one argument arrow function
Arrow functions, or lambdas as some languages call it, are frequently used in dart, even more so in the Flutter framework. Most of these arrow functions only contain one argument. At the language's current standing, if I were to write a `forEach` loop on a List, I would have to do something like this: ```dart void main(List<String> args) { List list = [1,2,3,4]; list.forEach((item) => /* Do something item */); } ``` `forEach` is just one of the many places that an arrow function is frequently used. As you can see, the parentheses around the `item` make the whole arrow function a little awkward to write and also read. I propose the following change: make the parenthensis around one argument arrow functions optional, permitting writing code as such: ```dart void main(List<String> args) { List list = [1,2,3,4]; list.forEach(item => /* Do something item */); } ``` This makes the code much cleaner to read and to write.
Comments (0)
No comments yet. Start the discussion.