resolveValue<T> function

T? resolveValue<T>(
  1. T? value, [
  2. T? def,
  3. ValueValidator valueValidator = isNotEmptyObject
])

Validates value and returns value or def.

Implementation

T? resolveValue<T>(T? value,
    [T? def, ValueValidator valueValidator = isNotEmptyObject]) {
  if (value == null) return def;
  var valid = valueValidator(value);
  return valid ? value : def;
}