Linter: avoid_types_on_closure_parameters should only apply for type repeating inferred type

Created on 26 Jul 2018  路  2Comments  路  Source: dart-lang/linter

dynamic x;
x = (String a) => a.length; // should be OK
bug false positive

Most helpful comment

One common use case is Stream#listen's onError callback with StackTrace:

  stream.listen(
      (event) => ...,
      onError: (dynamic e, StackTrace stackTrace) => ...
//                         ^^^^^^^^^^
//                         avoid_types_on_closure_parameters

All 2 comments

One common use case is Stream#listen's onError callback with StackTrace:

  stream.listen(
      (event) => ...,
      onError: (dynamic e, StackTrace stackTrace) => ...
//                         ^^^^^^^^^^
//                         avoid_types_on_closure_parameters

+1, along with https://github.com/dart-lang/linter/issues/2131 I think this would make it match omit_local_variable_types, which seems desirable.

Was this page helpful?
0 / 5 - 0 ratings