prefer_underscore_for_unused_callback_parameters

SeverityQuick FixOptions
Info

Details

DO use _ for unused callback parameters.

If the function has multiple unused parameters, use additional underscores such as __, ___.

see: effective-dart

Bad
itemBuilder: (context, index) {
  return Text('Item $index');
}
Good
itemBuilder: (_, index) {
  return Text('Item $index');
}

Usage

To enable the prefer_underscore_for_unused_callback_parameters rule, add prefer_underscore_for_unused_callback_parameters under custom_lint > rules in your analysis_options.yaml file:

custom_lint:
  rules:
    - prefer_underscore_for_unused_callback_parameters