fromTuplesArray static method
Creates a new StringValueMap from a list of key-value pairs called tuples. The method is similar to fromTuples but tuples are passed as array instead of parameters.
tuples
a list of values where odd elements are keys and the following even elements are values Returns a newly created StringValueMap.
Implementation
static StringValueMap fromTuplesArray(List? tuples) {
var result = StringValueMap();
if (tuples == null || tuples.isEmpty) return result;
for (var index = 0; index < tuples.length; index += 2) {
if (index + 1 >= tuples.length) break;
var name = StringConverter.toNullableString(tuples[index]);
var value = StringConverter.toNullableString(tuples[index + 1]);
if (name != null) {
result[name] = value;
}
}
return result;
}