flat<V> function
Flatting a list
that has other lists inside other lists inside other lists ... recursive
final multiList = ["Marcus", "Ana", "Emanuel", ["PC", "Xbox", "Books"]];
multiList.flat();// ["Marcus", "Ana", "Emanuel", "PC", "Xbox", "Books"]
Implementation
List<V> flat<V>(Iterable<V> list) {
return list
.expand((V element) => element is List ? flat(element) : <V>[element])
.cast<V>()
.toList();
}