Inspectopedia
 
2024.3

Constructor parameter is never used as a property

Warning
New
Last modified: 03 December 2024

Reports primary constructor parameters that can have val or var removed.

Class properties declared in the constructor increase memory consumption. If the parameter value is only used in the constructor, you can omit them.

Note that the referenced object might be garbage-collected earlier.

Example:

The quick-fix removes the extra val or var keyword: