title: What is the difference between constructor and initializer list in Dart?
body: <h2>Problem</h2>
  <p>The output of the following two codes are the same, but what is the essential difference?</p>
  <p><a href="https://www.dartlang.org/guides/language/language-tour#constructors" rel="noreferrer">A Tour of the Dart Language - Initializer list</a></p>
  <pre><code>import 'dart:math';
  
  class Point {
    final num x;
    final num y;
    final num distanceFromOrigin;
  
    Point(x, y)
        : x = x,
          y = y,
          distanceFromOrigin = sqrt(x * x + y * y);
  }
  
  main() {
    var p = Point(3, 4);
    print(p.distanceFromOrigin);
  }
  </code></pre>
  <p>My code</p>
  <pre><code>  Point(this.x, this.y)
        : distanceFromOrigin = sqrt(x * x + y * y);
  </code></pre>
  <p>Both Outputs are the same 5.</p>
  <h2>Question</h2>
  <ul>
  <li>How should I use constructor and initializer list properly?</li>
  </ul>
  <h2>Development Environment</h2>
  <ul>
  <li>Dart 2</li>
  <li><a href="https://dartpad.dartlang.org" rel="noreferrer">DartPad</a></li>
  </ul>
  <p>Best regards,</p>