extractProtoMethodResponseType function
String
extractProtoMethodResponseType(
)
Implementation
String extractProtoMethodResponseType(String filePath, String methodName) {
final content = File(filePath).readAsStringSync();
final services = parseProtoServices(content);
for (final service in services) {
for (final method in service.methods) {
if (method.name == methodName) {
final responseType = method.responseType;
if (responseType == 'void' || responseType == 'google.protobuf.Empty') {
return 'void';
}
return method.isServerStreaming
? 'Stream<$responseType>'
: responseType;
}
}
}
return 'dynamic';
}