copyWith method
✅ Add copyWith method
Implementation
ConditionalOn copyWith({
String? field,
List<dynamic>? values,
String? conditionalValueKey,
Regex? regex,
}) {
return ConditionalOn(
field: field ?? this.field,
values: values ?? List<dynamic>.from(this.values), // Clone the list
conditionalValueKey: conditionalValueKey ?? this.conditionalValueKey,
regex: regex ?? this.regex?.copyWith(), // Use copyWith for nested objects
);
}