StringMessage class

A message container for validation errors related to string values.

This class extends BaseMessage and provides validation messages specific to string-based validations, such as emails, URLs, UUIDs, and more.

Example

final stringMessages = StringMessage(
  min: (value) => 'At least $value characters required',
  max: (value) => 'No more than $value characters allowed',
  email: 'Enter a valid email',
  uuid: 'Invalid UUID',
);
Inheritance

Constructors

StringMessage.new({String? any, ArrayMessage? array, String? every, String? refine, String? required, String? alpha, String? alphanumeric, String? card, String? cep, String? cnpj, String? cpf, String? date, String? double, String? email, String contains(String data)?, String equals(String data)?, String endsWith(String suffix)?, String? ip, String? integer, String? jwt, String max(int max)?, String min(int min)?, String? password, String? pattern, String? phone, String? slug, String startsWith(String prefix)?, String? time, String? url, String? uuid})
Creates a new instance of StringMessage with customizable validation messages.

Properties

alpha String
Message for alphabetic character validation (letters only).
final
alphanumeric String
Message for alphanumeric character validation (letters and numbers only).
final
any String
The error message used when at least one of multiple validators must pass (or condition).
finalinherited
array ArrayMessage
The error message container for array-related validation errors.
finalinherited
card String
Message for credit card validation.
final
cep String
Message for postal code (CEP in Brazil) validation.
final
cnpj String
Message for CNPJ (Brazilian company tax ID) validation.
final
contains String Function(String data)
Message for the validation that ensures a string contains a specific substring.
final
cpf String
Message for CPF (Brazilian tax ID) validation.
final
date String
Message for date format validation.
final
double String
Message for double validation.
final
email String
Message for email validation.
final
endsWith String Function(String suffix)
Message for the validation that ensures a string ends with a specific suffix.
final
equals String Function(String data)
Message for the validation that ensures a string matches an exact value.
final
every String
The error message used when all of multiple validators must pass (and condition).
finalinherited
hashCode int
The hash code for this object.
no setterinherited
integer String
Message for integer validation.
final
ip String
Message for IP address validation.
final
jwt String
Message for JWT validation.
final
max String Function(int max)
Message for the maximum string length validation.
final
min String Function(int min)
Message for the minimum string length validation.
final
password String
Message for password validation.
final
pattern String
Message for general pattern validation.
final
phone String
Message for phone number validation.
final
refine String
The error message used when a custom refinement validation fails.
finalinherited
required String
The error message used when a required value is missing.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
slug String
Message for slug validation.
final
startsWith String Function(String prefix)
Message for the validation that ensures a string starts with a specific prefix.
final
time String
Message for time format validation.
final
url String
Message for URL validation.
final
uuid String
Message for UUID validation.
final

Methods

copyWith({String? alpha, String? alphanumeric, ArrayMessage? array, String? any, String? card, String? cep, String? cnpj, String contains(String data)?, String? cpf, String? date, String? double, String? email, String equals(String data)?, String endsWith(String suffix)?, String? every, String? ip, String? integer, String? jwt, String max(int max)?, String min(int min)?, String? password, String? pattern, String? phone, String? refine, String? required, String? slug, String startsWith(String prefix)?, String? time, String? url, String? uuid}) StringMessage
Creates a copy of the current StringMessage instance with updated values.
override
mergeWithBase(BaseMessage base) StringMessage
Merges the current StringMessage instance with a BaseMessage, replacing only the undefined values with those from the base.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited