.cuid()
Passes when the whole string is a c followed by at least eight characters that are not whitespace or -, case-insensitively. This is a format check only.
Signature
Section titled “Signature”StringValidator<O> cuid({String? message, MessageBuilder? messageBuilder})Parameters
Section titled “Parameters”| Parameter | Type | Meaning |
|---|---|---|
message |
String? |
Replaces the default error message. |
messageBuilder |
MessageBuilder? |
Builds the message from the issue. message wins when both are given. See Message builders. |
Code invalidCuid. Default message: value must be a valid cuid. value is replaced by the field name when there is one.
Code generation
Section titled “Code generation”@IsCuid(), or the constant @isCuid. Put the annotation on the constructor parameter or the field.
Example
Section titled “Example”final id = l.string().cuid();@IsCuid() required String id, // l.string().cuid().required()id.validate(input)+1-2- valid:
'cjld2cjxh0000qzrmn831i7rn' - invalid:
'xcjld2cjxh0000qzrmn831i7rn' - invalid:
'123'