operator + method

Iterable<T?> operator +(
  1. dynamic item
)

No way to override the + operator for an iterable, so I use a downcast to iterable

Implementation

Iterable<T?> operator +(item) {
  final self = this as List<T?>;

  if (item is List<T>) {
    self.addAll(item);
  } else if (item is T) {
    self.add(item);
  } else if (item == null) {
    self.add(null);
  } else {
    throw "Invalid input - must be null, $T, List<$T>";
  }
  return this;
}