The output of the following two codes are the same, but what is the essential difference?
A Tour of the Dart Language - Initializer list
There is no difference, the result will be the same except that you can take advantage of different type of constructors.
In the case you don't want to expose your variables defined in Point and your mark those as private, the initializer would be a good option.
class Point {
final num _x;
final num _y;
final num _distanceFromOrigin;
Point(x, y)
: _x = x,
_y = y,
_distanceFromOrigin = sqrt(x * x + y * y);
}
Also take a look to the constructor with optional parameters or factory constructors.