Arnav Gupta
Arnav Gupta

Reputation: 966

In Dart, what is the difference between using 'new' keyword and directly calling constructor?

I see I am allowed to use

argument: MyClassName(a,b)

as well as

argument: new MyClassName(a,b)

I wanted to understand is new optional in Dart? Or these two return totally different things?

Upvotes: 8

Views: 928

Answers (1)

mythz
mythz

Reputation: 143339

In Dart 2.0 strong mode new and const are optional so both are the same.

Upvotes: 10

Related Questions