scaleTo method
Changes the length of the vector to the length provided, without changing direction.
If you try to scale the zero (empty) vector, it will remain unchanged, and no error will be thrown.
Implementation
void scaleTo(double newLength) {
final l = length;
if (l != 0) {
scale(newLength.abs() / l);
}
}