Skip to content

use_if_null_to_convert_nulls_to_bools points to outdated guidance #58966

Open
@MaryaBelanger

Description

@MaryaBelanger

This lint refers to a section in Effect Dart that is changing quite a bit (based on this issue), to the point where the lint using it as a reference doesn't really make sense.

To summarize, the guidance will no longer be "PREFER using ?? to convert null to a boolean value", but just "DON'T use true or false in equality operations".

  • if (nullableBool ?? false) isn't necessarily "good" (like the lint promotes) because "Using a null-aware operator on a variable inside a condition doesn’t promote the variable to a non-nullable type".
  • Is "converting" null to boolean really even a use-case? The new guidance is more precise and applicable

The lint should change its name, description, or just not point to Effective Dart anymore.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3A lower priority bug or feature requestarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-linterIssues with the analyzer's support for the linter packagetype-documentationA request to add or improve documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions