getUsedVariableNames method
Collects all the variable names used in this node.
Implementation
Set<String> getUsedVariableNames({bool includePredefined = false}) {
final Set<String> usedVariables = {};
for (final path in variables.values) {
final match = VariableMatch.parse(path.wrapWithVariableSyntax());
if (match == null) continue;
final bool isPredefined = predefinedVariableNames.contains(match.name);
if (!includePredefined && isPredefined) continue;
usedVariables.add(match.name);
}
for (final paths in multipleVariables.values) {
for (final path in paths) {
final match = VariableMatch.parse(path.wrapWithVariableSyntax());
if (match == null) continue;
final bool isPredefined = predefinedVariableNames.contains(match.name);
if (!includePredefined && isPredefined) continue;
usedVariables.add(match.name);
}
}
return usedVariables;
}