getElement method
String
getElement(
- int index, {
- ConfigurationPropertyNameForm form = ConfigurationPropertyNameForm.original,
The text of the element at index in the given form (as written
unless given). A [...] element is returned as written, without the
brackets.
final name = ConfigurationPropertyName.adapt('app.readTimeout', '.');
name.getElement(1); // 'readTimeout'
name.getElement(1, form: ConfigurationPropertyNameForm.uniform);
// 'readtimeout'
Implementation
String getElement(
int index, {
ConfigurationPropertyNameForm form = ConfigurationPropertyNameForm.original,
}) {
final element = _elements[index];
if (element.indexed) {
return element.value;
}
return switch (form) {
ConfigurationPropertyNameForm.original => element.value,
ConfigurationPropertyNameForm.dashed => element.dashed,
ConfigurationPropertyNameForm.uniform => element.key,
};
}