15
6
DO use iterable.every instead of iterable.where().isEmpty.
iterable.every
iterable.where().isEmpty
const numbers = [1, 2, 3]; final areAllPositive = numbers.where((number) => number < 0).isEmpty;
const numbers = [1, 2, 3]; final areAllPositive = numbers.every((number) => number > 0);
To enable the prefer_iterable_every rule, add prefer_iterable_every under custom_lint > rules in your analysis_options.yaml file:
prefer_iterable_every
analysis_options.yaml
custom_lint: rules: - prefer_iterable_every