solid-software / solid_lints

🟧 Lints for Dart and Flutter based on software industry standards and best practices.
Other
36 stars 17 forks source link

False positives on `prefer_declaring_const_constructors` when class extends a class that cannot be const. #136

Closed arthurbcd closed 3 months ago

arthurbcd commented 3 months ago

The example below shows the false-positive:

class MyNotifier extends ChangeNotifier { // <- ChangeNotifier is a no-const class

// LINT (prefer_declaring_const_constructors)
MyNotifier(this.dependency);

final SomeDependency dependency;
}

It would be awesome if the linter knows that the extended class is not const.

If it's not possible, then maybe add an option to ignore if the class extends another. (and set it as default)