isRequired static method

bool isRequired(
  1. String? value, {
  2. bool allowEmptySpaces = true,
})

Implementation

static bool isRequired(String? value, {bool allowEmptySpaces = true}) {
  if (value == null || value.isEmpty) {
    return false;
  } else {
    if (!allowEmptySpaces) {
      // Check if the string is not only made of empty spaces
      if (RegExp(r"\s").hasMatch(value)) {
        return false;
      }
    }
    return true; // passed
  }
}