copyWith method
UiElement
copyWith({
- String? elementId,
- String? testId,
- String? type,
- String? role,
- String? label,
- String? text,
- String? hint,
- List<
String> ? options, - ElementLocator? suggestedLocator,
- bool clearSuggestedLocator = false,
- String? locatorWarning,
- bool clearLocatorWarning = false,
- UiElementState? state,
- UiBounds? bounds,
- List<
String> ? actions, - List<
UiElement> ? children, - Map<
String, Object?> ? metadata,
Copy with selected fields replaced.
Pass clearSuggestedLocator / clearLocatorWarning to null those fields.
Implementation
UiElement copyWith({
String? elementId,
String? testId,
String? type,
String? role,
String? label,
String? text,
String? hint,
List<String>? options,
ElementLocator? suggestedLocator,
bool clearSuggestedLocator = false,
String? locatorWarning,
bool clearLocatorWarning = false,
UiElementState? state,
UiBounds? bounds,
List<String>? actions,
List<UiElement>? children,
Map<String, Object?>? metadata,
}) {
return UiElement(
elementId: elementId ?? this.elementId,
testId: testId ?? this.testId,
type: type ?? this.type,
role: role ?? this.role,
label: label ?? this.label,
text: text ?? this.text,
hint: hint ?? this.hint,
options: options ?? this.options,
suggestedLocator: clearSuggestedLocator
? suggestedLocator
: (suggestedLocator ?? this.suggestedLocator),
locatorWarning: clearLocatorWarning
? locatorWarning
: (locatorWarning ?? this.locatorWarning),
state: state ?? this.state,
bounds: bounds ?? this.bounds,
actions: actions ?? this.actions,
children: children ?? this.children,
metadata: metadata ?? this.metadata,
);
}