flatten method
Used to get a copy of an given array collapsed into one dimension
var flat = m2d.flatten([[1, 2],[1, 2]]);
print(flat);
// [1,2,1,2]
Implementation
List flatten(List list) {
final _shapeCheck = _checkArray(list);
if (!_shapeCheck) throw new Exception('Uneven array dimension');
var result = [];
for (var i = 0; i < list.length; i++) {
if (list[i] is List) {
result.addAll(list[i]);
} else {
result.add(list[i]);
}
}
return result;
}