subscribeEvents method

void subscribeEvents({
  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 subscribeEvents({
  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) {
        onPairing(null, WCProposerMeta.fromJson(proposal['peerMeta']), null);
      },
      onPaired: (Map session) {
        onPaired(session);
      },
      onCallRequest: (Map payload) {
        onCallRequest(WCCallRequestData.fromJson(payload));
      },
      onDisconnect: (uri) {
        onDisconnect(uri);
      },
      uri: uri);
}