ValidationBuilder constructor

ValidationBuilder({
  1. bool optional = false,
  2. String? requiredMessage,
  3. ValidatorOptions? options,
  4. String? localeName,
  5. FormValidatorLocale? locale,
})

Implementation

ValidationBuilder({
  this.optional = false,
  this.requiredMessage,
  ValidatorOptions? options,
  String? localeName,
  FormValidatorLocale? locale,
})  : _locale = locale ??
          (localeName == null ? globalLocale : createLocale(localeName)),
      _options = options ?? globalOptions {
  ArgumentError.checkNotNull(_locale, 'locale');
  // Unless a builder is optional, the first thing we do is to add a
  // [required] validator. All subsequent validators should expect
  // a non-null argument.
  if (!optional) required(requiredMessage);
}