insertElementBetween method
insert Element Between Example:
[1, 2, 3].insertElementBetween(0); // [1, 0, 2, 0, 3]
Implementation
List<T> insertElementBetween(T element) => fold([], (result, item) {
if (result.isEmpty) {
result.add(item);
} else {
result.add(element);
result.add(item);
}
return result;
});