diff --git a/lib/src/client.dart b/lib/src/client.dart index a3637dd..7aa0479 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -113,8 +113,8 @@ class Client { /// /// Throws a [StateError] if the client is closed while the request is in /// flight, or if the client is closed when this method is called. - Future sendRequest(String method, [Object? parameters]) { - var id = _id++; + Future sendRequest(String method, [Object? parameters, int? id]) { + id ??= _id++; _send(method, parameters, id); var completer = Completer.sync(); diff --git a/lib/src/peer.dart b/lib/src/peer.dart index 002af31..9774ff4 100644 --- a/lib/src/peer.dart +++ b/lib/src/peer.dart @@ -94,8 +94,8 @@ class Peer implements Client, Server { // Client methods. @override - Future sendRequest(String method, [Object? parameters]) => - _client.sendRequest(method, parameters); + Future sendRequest(String method, [Object? parameters, int? id]) => + _client.sendRequest(method, parameters, id); @override void sendNotification(String method, [Object? parameters]) =>