ValidateNonBlankStringParamAllowNull static method

void ValidateNonBlankStringParamAllowNull(
  1. String? param,
  2. String paramName
)
Validates string parameter to be non-empty string (null value allowed). The string parameter. Name of the parameter.

Implementation

static void ValidateNonBlankStringParamAllowNull(
    String? param, String paramName) {
  if (param != null) {
    // Non-empty string has at least one character which is *not* a whitespace character
    if (param.length == param.allMatches(" ").length) {
      throw new ArgumentException("Strings.ArgumentIsBlankString $paramName");
    }
  }
}