'How can I spread a List in Dart?

Is there any way to unpack a list in dart? I want to do something similar to this python snippet:

return proc(*args)


Solution 1:[1]

Dart does not support unpacking a List into function arguments.

However, you can unpack a List into another List by typing three dots ... before the list name.

List<int> oneTwo = [1, 2];
List<int> oneTwoThree = [...oneTwo, 3];

print(oneTwoThree); // [1, 2, 3]

More info here: https://dart.dev/guides/language/language-tour#spread-operator

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Nate