notNull static method

String? notNull(
  1. String? checkValue, {
  2. String? errorMessage,
})

Checks that checkValue is not null.

If checkValue is null the function will return errorMessage if provided, or the default error if not. Otherwise null is returned

Implementation

static String? notNull(String? checkValue, {String? errorMessage}) {
  if (checkValue == null) {
    return errorMessage ?? "Field can't be empty";
  }
  return null;
}