Skip to content

prefer_void_to_null false positive for extension types #59308

@lrhn

Description

@lrhn

Example:

extension type B<T>(T? _) {}
extension type N(Null _) implements B<Never> {}

which yields the info:

Analyzing badwarn.dart...

   info - badwarn.dart:2:18 - Unnecessary use of the type 'Null'.
          Try using 'void' instead. - prefer_void_to_null

1 issue found.

Since changing Null to void would be a compile-time error, extension type representation types might not be the best place to apply that info.
(Any time a type has to be a subtype of some other type, suggesting void instead of Null risks being invalid.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2A bug or feature request we're likely to work ondevexp-linterIssues with the analyzer's support for the linter packagelegacy-area-analyzerUse area-devexp instead.linter-false-positiveIssues related to lint rules that report a problem when it isn't a problem.linter-set-recommendedtype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions