isNullOrEmpty method

bool isNullOrEmpty(
  1. T? valueCandidate
)

Checks if the value is null or empty. Returns true if the value is null or empty, otherwise false. The value is considered empty if it is a String, Iterable, or Map and it is empty or contains only whitespace characters. If the value is not a String, Iterable, or Map, it is considered empty if it is null.

Implementation

bool isNullOrEmpty(T? valueCandidate) {
  return valueCandidate == null ||
      (valueCandidate is String && valueCandidate.trim().isEmpty) ||
      (valueCandidate is Iterable && valueCandidate.isEmpty) ||
      (valueCandidate is Map && valueCandidate.isEmpty);
}