sendRequest<T extends Result?> method
Sends request
to the peer, and handles coercing the response to the
type T
.
Closes any progress streams for request
once the response has been
received.
Implementation
Future<T> sendRequest<T extends Result?>(
String methodName, [
Request? request,
]) async {
try {
return ((await _peer.sendRequest(methodName, request)) as Map?)
?.cast<String, Object?>()
as T;
} finally {
final token = request?.meta?.progressToken;
if (token != null) {
await _progressControllers.remove(token)?.close();
}
}
}