Skip to content

Incorrect prefer_is_empty warning #58189

Closed
@spkersten

Description

@spkersten

Consider:

class Foo {
  const Foo(List<int> numbers)
      : assert(numbers.length > 0),
        assert(numbers.isNotEmpty);
}

The first assert results in a warning say:

info: Use isNotEmpty instead of length (prefer_is_empty at [...] ...)

But following that suggestion (the second assert) is an error:

error: Invalid constant value. (invalid_constant at [...] ...)

Dart 2.7.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    devexp-linterIssues with the analyzer's support for the linter packagelegacy-area-analyzerUse area-devexp instead.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions