Open
Description
Describe the issue
I had a tear-off on my parameter, but I had to change it with a ternary operator. That triggered this false positive.
To Reproduce
argument_type_not_assignable
triggering on:
void fn({
required void Function(String) parameter,
}) {...}
void function2([String? text]) {...}
void callback() {...}
// Example:
...
fn(
parameter: (test) ? function2 : (_) => callback(),
);
...
When I "solved" that with:
fn(
parameter: (test) ? (str) => function2(str) : (_) => callback(), // triggering `unnecessary_lambdas`
);
Previously I had (and it was working):
fn(
parameter: function2,
);
Expected behavior
argument_type_not_assignable
not triggering when that solves unnecessary_lambdas
or stopping unnecessary_lambdas
from triggering.
Metadata
Metadata
Assignees
Labels
A lower priority bug or feature requestFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.Issues with the analyzer's support for the linter packageIssues related to lint rules that report a problem when it isn't a problem.Incorrect behavior (everything from a crash to more subtle misbehavior)