Skip to content

avoid_function_literals_in_foreach_calls missing case - unqualified #61141

@FMorschel

Description

@FMorschel

Repro:

void foo(List<int> list) {
  list.forEach((element) { // avoid_function_literals_in_foreach_calls
    if (element.isEven) print(element);
  });
}

extension on List<int> {
  void printEvenNumbers() {
    forEach((element) { // nothing
      if (element.isEven) print(element);
    });
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions