How constructors can initialize final fields with complex algorithm?
问题 I am writing an immutable class Vector3. class Vector3 { final num x, y, z; Vector3(this.x, this.y, this.z); num get length => ...some heavy code } Now, I want to write a constructor that computes the unit vector from another vector. I want to do that according to the Dart's recommendations (avoid writing a static method when we create a new object). My problem is that I can't write this constructor because the final fields must be initialized before the constructor's body and cannot be