在Dart中,使用'new'关键字和直接调用构造函数有什么区别? [英] In Dart, what is the difference between using 'new' keyword and directly calling constructor?

查看:141
本文介绍了在Dart中,使用'new'关键字和直接调用构造函数有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我可以使用

argument: MyClassName(a,b)

以及

argument: new MyClassName(a,b)

我想了解的是在Dart中可选吗?还是这两个返回的东西完全不同?

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

推荐答案

在Dart 2.0强模式下 new和const是可选的,因此两者相同。

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

这篇关于在Dart中,使用'new'关键字和直接调用构造函数有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆