보통은 new 키워드를 통해 생성자라고 표시하는데, Dart언어에서는 생략할 수 있기 때문에 안써줘도 된다.
void main() {
Tesla myTesla = Tesla("red"); ++ new 생략 가능
Tesla myDaughterTesla = Tesla("blue");
Tesla myFirstDaughterTesla = Tesla("pink");
print(myFirstDaughterTesla.color);
}
class Tesla {
String color = "white";
//constructor
Tesla(String selectedColor) {
color = selectedColor;
}
}