copyWith method

  1. @override
IValidator copyWith({
  1. bool? nullable,
  2. bool? optional,
  3. IValidator? condition,
  4. IValidator? then,
  5. IValidator? otherwise,
})
override

Creates a copy of the validator with the given parameters.

Implementation

@override
IValidator copyWith({
  bool? nullable,
  bool? optional,
  IValidator? condition,
  IValidator? then,
  IValidator? otherwise,
}) {
  return WhenValidator(
    condition ?? this.condition,
    then ?? this.then,
    otherwise ?? this.otherwise,
    nullable: nullable ?? isNullable,
    optional: optional ?? isOptional,
  );
}