Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does that 2 dots mean? What is the difference between 1 and 2?

Tags:

flutter

dart

I have seen a lot of tutorials using dot, while some use 2. What is the actual meaning of this?

Example,

Array().add()

Animation()..addListener(() {})
like image 518
user10583336 Avatar asked Nov 04 '18 01:11

user10583336


People also ask

What does 2 dots on a number mean?

A pair of overdots placed over a symbol, as in , most commonly used to denote a second derivative with respect to time, i.e., .

What are the difference between single dots and double dots?

In filesystems, we use the double dot (..) to access the parent directory, whereas the single dot (.) represents the current directory.

What are the two dots in punctuation?

The colon : is a punctuation mark consisting of two equally sized dots aligned vertically. A colon often precedes an explanation, a list, or a quoted sentence.


1 Answers

The .. operator is dart "cascade" operator. Useful for chaining operations when you don't care about the return value. This is also dart solution to chainable functions that always return this

It is made so that the following

final foo = Foo()
 ..first()
 ..second();

Is strictly equals to this:

final foo = Foo();
foo.first();
foo.second();
like image 82
Rémi Rousselet Avatar answered Oct 09 '22 02:10

Rémi Rousselet