extractKeys function
Extracts key-value pairs from the constants file
Implementation
Map<String, String> extractKeys(String content) {
final regex = RegExp(
r'''static\s+(?:const\s+)?(?:String\s+)?([A-Za-z_]\w*)\s*=\s*(?:'([^']*)'|"([^"]*)");''',
multiLine: true,
);
final matches = regex.allMatches(content);
final keys = <String, String>{};
for (final m in matches) {
final key = m.group(1)!;
final value = m.group(2) ?? m.group(3) ?? '';
keys[key] = value;
}
return keys;
}