Skip to content

analyzer complains even when checking for null values #44463

Closed
@MohiuddinM

Description

@MohiuddinM

I get an error even when checking for null value:
An expression whose value can be 'null' must be null-checked before it can be dereferenced at

class T {
  final String? s;

  T(this.s);

  void f() {
    if (s != null && s.length > 3) {}
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions