Pattern: Missing use of isNotEmpty
for Iterable
/Map
Issue: -
When testing whether an Iterable
or Map
is empty, prefer isNotEmpty
over !isEmpty
to improve code readability.
Example of correct code:
if (todo.isNotEmpty) {
sendResults(request, todo.isEmpty);
}
Example of incorrect code:
if (!sources.isEmpty) {
process(sources);
}