Add operator for calling a function with the preceeding object as first argument. #18516
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
Example syntax:
object->function(arg2, arg3)
which is syntactic sugar for
function(object, arg2, arg3)
but with the same precedence as '.'.
This allows chaining a function call that isn't a method.
Currently calling a function on the result of a chain of method calls needs to wrap everything with the function. E.g.:
func2(func1(object.m1().m2().m3()).m4().m5()).m6()
could become the much more readable:
object.m1().m2().m3()->func1().m4().m5()->func2().m6()
(This is primarily a work-around for not having extension methods.)
The text was updated successfully, but these errors were encountered: