.endsWith()
Passes when value.endsWith(suffix) is true. Case-sensitive.
Signature
Section titled “Signature”StringValidator<O> endsWith(String suffix, {String? message, MessageBuilder? messageBuilder})Parameters
Section titled “Parameters”| Parameter | Type | Meaning |
|---|---|---|
suffix |
String |
The required suffix. params['suffix']. |
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 missingSuffix. Default message: value does not end with ".dart". value is replaced by the field name when there is one.
Code generation
Section titled “Code generation”@EndsWith(s). Put the annotation on the constructor parameter or the field.
Example
Section titled “Example”final path = l.string().endsWith('.dart');@EndsWith('.dart') required String path, // l.string().endsWith(".dart").required()path.validate(input)+1-1- valid:
'main.dart' - invalid:
'main.js'