isNullOrEmpty static method

bool isNullOrEmpty(
  1. dynamic value
)

Checks if a given value is considered "null" or empty.

Supports null, empty String, and empty List or Map.

Implementation

static bool isNullOrEmpty(dynamic value) {
  if (value == null) return true;
  if (value is String && value.trim().isEmpty) return true;
  if (value is Iterable && value.isEmpty) return true;
  if (value is Map && value.isEmpty) return true;
  return false;
}