addTo<T> function

void addTo<T>(
  1. List<T> target,
  2. List parts
)

Implementation

void addTo<T>(List<T> target, List parts) {
  for (final part in parts) {
    if (part is T) {
      target.add(part);
    } else if (part is List) {
      addTo<T>(target, part);
    }
  }
}