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