Skip to content

use_null_aware_elements does not trigger on chain call #60814

Open
@tenhobi

Description

@tenhobi

Currently use_null_aware_elements works on cases such as

String? getValue() => 'abc';
final value = getValue();

final x = {
  if (value != null) 'key': value,
};

which produces

String? getValue() => 'abc';
final value = getValue();

final x = {
  'key': ?value,
};

but when we use chain calls it does not work

String? getValue() => 'abc';
final value = getValue();

final x = {
  if (value != null) 'key': value.length,
};

even through it is still valid to transform it using null aware elements to

String? getValue() => 'abc';
final value = getValue();

final x = {
  'key': ?value?.length,
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-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 packagelinter-false-negative

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions