I've solved several solutions on Codewars and saw that one solution uses [...], I tried to google what it is, but google only finds how to create arrays (List a = [1, 2, 3]), how to get the second element, etc.
Solution: List<int> reverseList(List<int> list)=>[...list.reversed]
;
CodePudding user response:
in Dart when we use the three dots (...) it means that we are unpacking one and taking its values and throwing it, so when we have
List<int> reverseList(List<int> list)=>[...list.reversed]
means that we take the reverse list
, unpack it and throw it in another List that you are creating