message method

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

The message that will be displayed if the validation fails. This message should be user-friendly and explain why the validation failed.

This property provides feedback to the user when a validation rule is not met. The message should be clear and informative, helping the user understand what went wrong and how they can correct the input. It is important that the message is written in a way that is easy to understand, avoiding technical jargon.

Implementation

@override
String message(dynamic value, [List<String>? options]) {
  if (options != null && options.length == 2) {
    return 'The field must be between ${options[0]} and ${options[1]}.';
  }
  return 'The field must be between a given range.';
}