permutate static method
Creates a permutation if the given list data
by swapping each items to get the amount of data.length
!.
If the data consists of 4 items, the permutation will create 24 possible combinations (432*1=24).
Example
data = "A", "B", "C"
result = [A, B, C
, B, A, C
, C, A, B
, A, C, B
, B, C, A
, C, B, A
]
Implementation
static List<List<dynamic>> permutate(List<dynamic> data) {
var store = <List<dynamic>>[];
var tmp = <dynamic>[];
tmp.addAll(data);
_permutate(data.length, tmp, store);
return store;
}