I have trouble understanding the bellow section of the code. Debugging the code don't help because things don't turnout as I expected. For example, in numberList = []
line, litteral syntax [ ] must initialize the list and make it empty but after execution of this line numberList has value?!
// As I know this line should empty the list? but it doesn't?
numberList= []
// This line adds a value to numberList list and create a new object as a return?
..add(1)
// How list numberList will be added to numberList again? This part is really confusing to me
..addAll(numberList);
Complete Code:
void main() {
List<int> numberList=[10];
numberList=[]..add(1)..add(2)..addAll(numberList);
print(numberList);
}
It seems adds 1 and 2 to [ ] (new list object), and then adds all numberList's items to [ ], and finally Assigns [1,2,10] list to numberList.
Is there a way to debug to see each addition? How can I define name to this so called anonymous or on the fly list?