isNotNullAndEmpty property

bool get isNotNullAndEmpty

Returns true if the list is not null and contains at least one element.

Example:

List<num>? list1 = [1, 2, 3];
print(list1.isNotNullAndEmpty); // true

List<num>? list2 = [];
print(list2.isNotNullAndEmpty); // false

List<num>? list3 = null;
print(list3.isNotNullAndEmpty); // false

Implementation

bool get isNotNullAndEmpty => this != null && this!.isNotEmpty;