message method

  1. @override
String message(
  1. dynamic value, [
  2. List<String>? options
])
override

Returns the default message for a failed validation.

value is the value that failed and options are the parsed rule options. Return an empty string when a failed rule should not add an error entry; Validator still treats the rule as failed for bail behavior.

Implementation

@override
String message(dynamic value, [List<String>? options]) {
  if (options != null && options.isNotEmpty) {
    return 'The field must contain all of the following values: ${options.join(', ')}.';
  }
  return 'The field must contain the specified values.';
}