Vincent
Vincent

Reputation: 3304

What's the difference between "Text" and "new Text" in dart?

What's the difference between Text and new Text in dart? Also suitable for Container and all other widgets.

Upvotes: 0

Views: 322

Answers (2)

Pete Houston
Pete Houston

Reputation: 15089

As of Dart 2, you don't need to use new keyword to create a new instance. So basically, if you're developing in Flutter and Dart 2+, Text and new Text is the same.

Take a look at the Dart documentation about constructors.

Upvotes: 2

Denis Sablukov
Denis Sablukov

Reputation: 3690

In Dart 2 new is an optional keyword. So Text and new Text is basically the same thing.

Upvotes: 2

Related Questions