hasFunction method
Returns true if the script file contains a function with the given functionName.
Returns false if the file does not exist or if the function is not found.
Implementation
Future<bool> hasFunction(String functionName) async {
final script = await contents();
if (script == null) {
return false;
}
final lines = script.split('\n');
for (final line in lines) {
if (line.startsWith('$functionName() {')) {
return true;
}
}
return false;
}