joinSeparator method

List<T> joinSeparator(
  1. T separator
)

Implementation

List<T> joinSeparator(T separator) {
  List<T> result = [];
  for (int i = 0; i < length; i++) {
    if (i > 0) {
      result.add(separator);
    }
    result.add(this[i]);
  }
  return result;
}