productNum<T extends num> function

dynamic productNum<T extends num>(
  1. Iterable<T> l
)

Multiply all elements.

Implementation

productNum<T extends num>(Iterable<T> l) {
  if (l.isEmpty) {
    return 0;
  }
  num result = 1;
  for (num n in l) {
    result *= n;
  }
  return result as T;
}