I've got a function that should accept two diffrent data types as input:
vec3 add(vec3 vec){
this.x += vec.x;
this.y += vec.y;
this.z += vec.z;
return this;
}
vec3 add(num scalar){
this.x += scalar;
this.y += scalar;
this.z += scalar;
return this;
}
but this returns an error:
The name 'add' is already defined
Is there a way to make this work in Dart? I know that types are optional but I would like to know whether there is a way.