Skip to content

False positive for unnecessary_lambdas #57957

@davidmorgan

Description

@davidmorgan
  int count(String s) => s.length;
  final strings = ['a', 'bb', 'ccc', 'dddd'];
  final map = Map<String, int>.fromIterable(strings, value: (s) => count(s)); // lint fires here

...apply suggestion...

final map = Map<String, int>.fromIterable(strings, value: count);

error: The function 'count' has type '(String) → int' that isn't of expected type '(dynamic) → int'. This means its parameter or return type does not match what is expected.

Metadata

Metadata

Assignees

Labels

customer-google3devexp-linterIssues with the analyzer's support for the linter packagelegacy-area-analyzerUse area-devexp instead.linter-false-positiveIssues related to lint rules that report a problem when it isn't a problem.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions