getFunctionBodyByName method
Returns the function body of a method by its name.
If a method with the specified name is not found or has no body, returns null.
name - The name of the method whose body should be retrieved.
Return value:
FunctionBody?: The body of the method with the given name, ornullif not found or has no body.
Implementation
FunctionBody? getFunctionBodyByName(String name) {
final MethodDeclaration? method = getMethod(name);
if (method == null) return null;
return method.body;
}