operator unary- method
Unary operator: Returns a new list
containing the elements of this
multiplied by -1.
Implementation
List<num> operator -() {
if (this is List<int>) {
return List<int>.generate(length, (i) => -(this[i] as int));
} else if (this is List<double>) {
return List<double>.generate(length, (i) => -(this[i] as double));
} else {
return List<num>.generate(length, (i) => -this[i]);
}
}