title: How constructors can initialize final fields with complex algorithm?
body: <p>I am writing an immutable class Vector3.</p>
  
  <pre><code>class Vector3
  {
    final num x, y, z;
    Vector3(this.x, this.y, this.z);
    num get length =&gt; ...some heavy code
  }
  </code></pre>
  
  <p>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).</p>
  
  <p>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 initialized inside. I can write something like :</p>
  
  <pre><code>Vector3.unit(Vector3 vector)
    : x = vector.x / vector.length,
      y = vector.y / vector.length,
      z = vector.z / vector.length;
  </code></pre>
  
  <p>But this is so sad I have to compute three times the length of the vector...</p>
  
  <p>How am I supposed to do that? Should I finally write a static method to compute the unit vector? (It would be a shame)</p>
  
  <p>And, at last, isn't it possible to write anything in the constructor's body related to the initialization of the final fields? And why?</p>
  
  <p>Thanks!</p>