unnecessary_ new
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
:
var o = new Object();
Common fixes
#Remove the keyword new
:
var o = Object();
Unless stated otherwise, the documentation on this site reflects Dart 3.9.2. Page last updated on 2025-9-1. View source or report an issue.