enforce method
Validates input data, and throws an error if it is invalid.
Otherwise, the filtered data is returned.
Implementation
Map<String, dynamic> enforce(Map inputData,
{String errorMessage = 'Invalid data.'}) {
var result = check(inputData);
if (result._errors.isNotEmpty) {
throw ValidationException(errorMessage, errors: result._errors);
}
return result.data;
}