Closed
Description
Describe the issue
Some SDK functions type their error callback parameter as Function
to accept both Function(Object)
and Function(Object, StackTrace)
:
Future future;
future.then(..., onError: <this callback>);
As such, writing the following will trigger implicit-dynamic:
Future future;
future.then(..., onError: (err, stack) {
// err and stack are both dynamic
});
The solution should be to explicitly write the type:
Future future;
future.then(..., onError: (Object err, StackTrace stack) {
// fixed implicit-dynamic
});
but doing this now causes avoid_types_on_closure_parameters
on both parameters
Expected behavior
I would expect avoid_types_on_closure_parameters to detect that Object/StackTrace are types more specific than dynamic
, and therefore allow it.
Additional context