disconnectSession method
Implementation
@override
Future<void> disconnectSession({
required String topic,
required ReownSignError reason,
}) async {
_checkInitialized();
_confirmOnlineStateOrThrow();
try {
await _isValidDisconnect(topic);
if (sessions.has(topic)) {
// Send the request to delete the session, we don't care if it fails
try {
final deleteRequest = WcSessionDeleteRequest(
code: reason.code,
message: reason.message,
data: reason.data,
);
core.pairing.sendRequest(
topic,
MethodConstants.WC_SESSION_DELETE,
deleteRequest.toJson(),
);
} catch (_) {}
await _deleteSession(topic);
} else {
await core.pairing.disconnect(topic: topic);
}
} on ReownSignError catch (error, s) {
core.logger.e(
'[$runtimeType] disconnectSession()',
error: error,
stackTrace: s,
);
}
}