fromString static method
Parses semicolon-separated key-value pairs and returns them as a StringValueMap.
line
semicolon-separated key-value list to initialize StringValueMap. Returns a newly created StringValueMap.
Implementation
static StringValueMap fromString(String? line) {
var result = StringValueMap();
if (line == null || line.isEmpty) return result;
var tokens = line.split(';');
for (var index = 0; index < tokens.length; index++) {
var token = tokens[index];
if (token.isEmpty) continue;
var pos = token.indexOf('=');
var key = pos > 0 ? token.substring(0, pos).trim() : token.trim();
var value = pos > 0 ? token.substring(pos + 1).trim() : null;
result.put(key, value);
}
return result;
}