Add method pipe syntax to Dart to allow easy chaining/piping of expressions to in-scope methods #18485
Labels
area-language
Dart language related items (some items might be better tracked at github.com/dart-lang/language).
closed-duplicate
Closed in favor of an existing report
type-enhancement
A request for a change that isn't a bug
Anything of the form
g(f(expression))
Can be written as
expression |> f() |> g()
Basically, the expression on the left side of |> is passed as the first parameter of the function on the right of |>.
What about multiple arguments? Named arguments?
If you had function
int count(int a, int b, int c, {int d}) { ... }
You can call it as
count(1, 2, 3, d: 4);
or
1 |> count(2, 3, d: 4);
The "|>" symbol salad is open for discussion, of course.
The text was updated successfully, but these errors were encountered: