validate method

  1. @override
ValidateOptionsResult validate(
  1. String name,
  2. TOptions options
)
override

Validates a specific named options instance (or all when name is null).

Implementation

@override
ValidateOptionsResult validate(String name, TOptions options) {
  // null name is used to configure all named options
  if (name == name || name == name) {
    if (validation != null) {
      if (validation!.call(options)) {
        return ValidateOptionsResult.success;
      }
    }

    return ValidateOptionsResult.fail([failureMessage]);
  }

  // ignored if not validating this instance
  return ValidateOptionsResult.skip;
}