prefer_is_not_empty

Group: style

Maturity: stable

Dart SDK: >= 2.0.0 • (Linter v0.1.5)

Since info is static, may be stale
flutterpedantic

View all Lint Rules

Using the Linter

PREFER x.isNotEmpty to !x.isEmpty for Iterable and Map instances.

When testing whether an iterable or map is empty, prefer isNotEmpty over !isEmpty to improve code readability.

GOOD:

if (todo.isNotEmpty) {
  sendResults(request, todo.isEmpty);
}

BAD:

if (!sources.isEmpty) {
  process(sources);
}