Skip to content

use_if_null_to_convert_nulls_to_bools does not handle false equality checks? #58534

Closed
@pq

Description

@pq

When looking at #58533, I was surprised to find that use_if_null_to_convert_nulls_to_bools doesn't seem to handle cases like this:

List<String>? strings;

bool f() => strings?.isEmpty == false;

I'd expect the preferred way to express this would be:

List<String>? strings;

bool f() => strings?.isEmpty ?? false;

@a14n: do you recall if this was intentional (and I'm forgetting some rationale) or an oversight?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    devexp-linterIssues with the analyzer's support for the linter packagelegacy-area-analyzerUse area-devexp instead.type-questionA question about expected behavior or functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions