flattenDeep<T> function
Recursively flattens array.
It returns newObject
of deeply flattened array and does not affects the list object called-upon.
var list = [2, [1, 3], [4, [1, [2]] ] ];
var newList = flattenDeep(list); // newList = [2, 1, 3, 4, 1, 2];
Implementation
List<T> flattenDeep<T>(List<T> list) {
return list.flattenDeep() as List<T>;
}