parseKeyValuePairs function
Implementation
Map<String, String> parseKeyValuePairs(String s, Set<String> targetKeys) {
final result = <String, String>{};
final pairs = s.split(';');
for (final pair in pairs) {
final index = pair.indexOf(':');
if (index < 0) {
continue;
}
final key = pair.substring(0, index).trim();
if (targetKeys.contains(key)) {
result[key] = pair.substring(index + 1).trim();
}
}
return result;
}