validateIsEmpty function

bool validateIsEmpty({
  1. String? value,
  2. bool excludeWhiteSpace = true,
})

check if the value is empty or not

when value is null or value length is zero, it will return true

when excludeWhiteSpace is true all white space will be replaced by string empty

Implementation

bool validateIsEmpty({
  String? value,
  bool excludeWhiteSpace = true,
}) {
  if (value == null) {
    return true;
  }
  if (excludeWhiteSpace) {
    value = value.removeWhiteSpace();
  }
  return value.isEmpty;
}