unionList<T> function

List<T> unionList<T>(
  1. Iterable<T> original,
  2. Iterable<T> input
)

Get new elements from input

Implementation

List<T> unionList<T>(Iterable<T> original, Iterable<T> input) {
  List<T> l1 = List.from(original);
  List<T> l2 = List.from(input);
  List<T> result = List.from(l1);
  for (T element in l2) {
    if (!result.contains(element)) {
      result.add(element);
    }
  }

  return result;
}