addTestId method
Adds value
to the prop key
(delimited with a single space).
Allows for an element to have multiple test IDs to prevent overwriting when cloning elements or components.
For use in a testing environment (when testMode is true).
Implementation
void addTestId(String? value, {String key = defaultTestIdKey}) {
if (!_inTestMode || value == null) {
return;
}
String? testId = getTestId(key: key);
if (testId == null) {
props[key] = value;
} else {
props[key] = getTestId(key: key)! + ' $value';
}
}