operator * method
Returns a new list containing the elements of this
multiplied with scalar
.
Implementation
List<num> operator *(num scalar) {
if (this is List<int> && scalar is int) {
return List<int>.generate(length, (i) => (this[i] as int) * scalar);
} else if (this is List<double> || scalar is double) {
return List<double>.generate(length, (i) => this[i].toDouble() * scalar);
}
return List<num>.generate(length, (i) => this[i] * scalar);
}