subscribeEventsV2 method

void subscribeEventsV2({
  1. required dynamic onPairing(
    1. WCPairingData?,
    2. WCProposerMeta?,
    3. String?
    ),
  2. required dynamic onPaired(
    1. Map
    ),
  3. required dynamic onCallRequest(
    1. WCCallRequestData
    ),
  4. required dynamic onDisconnect(
    1. String
    ),
  5. String? uri,
})

Implementation

void subscribeEventsV2({
  required Function(WCPairingData?, WCProposerMeta?, String?) onPairing,
  required Function(Map) onPaired,
  required Function(WCCallRequestData) onCallRequest,
  required Function(String) onDisconnect,
  String? uri,
}) {
  service.subscribeEvents(
      onPairing: (Map proposal) {
        final prop = WCPairingData.fromJson(proposal['proposal']);
        onPairing(prop, prop.params?.proposer?.metadata, proposal['uri']);
      },
      onPaired: (Map session) {
        onPaired(session);
      },
      onCallRequest: (Map payload) {
        onCallRequest(WCCallRequestData.fromJson(payload));
      },
      onDisconnect: (uri) {
        onDisconnect(uri);
      },
      uri: uri,
      isV2: true);
}