prefer_iterable_every

SeverityQuick FixOptions
Info

Details

DO use iterable.every instead of iterable.where().isEmpty.

Bad
const numbers = [1, 2, 3];
final areAllPositive = numbers.where((number) => number < 0).isEmpty;
Good
const numbers = [1, 2, 3];
final areAllPositive = numbers.every((number) => number > 0);

Usage

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

custom_lint:
  rules:
    - prefer_iterable_every