Skip to content

.endsWith()

Passes when value.endsWith(suffix) is true. Case-sensitive.

StringValidator<O> endsWith(String suffix, {String? message, MessageBuilder? messageBuilder})
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.

@EndsWith(s). Put the annotation on the constructor parameter or the field.

final path = l.string().endsWith('.dart');
path.validate(input)+1-1
  1. valid: 'main.dart'
  2. invalid: 'main.js'value does not end with ".dart"