As stated in the official text of the Dart Method Cascades in Dart article :
The syntax ".." calls the method (either setter or getter), but discards the result and instead returns the original receiver .
In short, method cascades provide syntactic sugar for situations where the recipient of a method call might otherwise repeat.
The following is an example based on / copied from a previously quoted article. Read it for more information.
add() example
In a scenario where you need to add multiple items to a list, the inherited method is to perform multiple assignments:
myList.add("item1"); myList.add("item2"); // add again and again… myList.add("itemN");
Until you can do something like myList.add("item1").add("item1")….add("itemN"); , since add() does not return the method myList object but void , you can use the cascading operator, because it discards the result and returns the original receiver myList :
myList..add("item1")..add("item2")…..add("itemN");
myList.add("item1").add("item2")….add("itemN");
Another example
So instead of writing:
var address = getAddress(); address.setStreet("Elm", "13a"); address.city = "Carthage"; address.state = "Eurasia" address.zip(66666, extended: 6666);
Can write
getAddress() ..setStreet("Elm", "13a") ..city = "Carthage" ..state = "Eurasia" ..zip(66666, extended: 6666);
Further reading
If you want to know more about the cascade method, I wrote an article adding information that is beyond the scope of this question .