unnecessary_new
Details about the 'unnecessary_new' diagnostic produced by the Dart analyzer.
Unnecessary 'new' keyword.
Description
#
The analyzer produces this diagnostic when the keyword new is used to
invoke a constructor.
Example
#
The following code produces this diagnostic because the keyword new is
used to invoke the unnamed constructor from Object:
dart
var o = new Object();
Common fixes
#Remove the keyword new:
dart
var o = Object();
Was this page's content helpful?
除非另有说明,文档之所提及适用于 Dart 3.10.3 版本报告页面问题.