updateClient method

  1. @override
Future<void> updateClient(
  1. String nodeUrl,
  2. String token,
  3. String userId,
  4. String? deviceId,
  5. String? deviceName,
  6. String? prevBatch,
  7. String? olmAccount,
)
override

Implementation

@override
Future<void> updateClient(
  String nodeUrl,
  String token,
  String userId,
  String? deviceId,
  String? deviceName,
  String? prevBatch,
  String? olmAccount,
) async {
  await transaction(() async {
    await _clientBox.put('node_url', nodeUrl);
    await _clientBox.put('token', token);
    await _clientBox.put('user_id', userId);
    if (deviceId == null) {
      await _clientBox.delete('device_id');
    } else {
      await _clientBox.put('device_id', deviceId);
    }
    if (deviceName == null) {
      await _clientBox.delete('device_name');
    } else {
      await _clientBox.put('device_name', deviceName);
    }
    if (prevBatch == null) {
      await _clientBox.delete('prev_batch');
    } else {
      await _clientBox.put('prev_batch', prevBatch);
    }
    if (olmAccount == null) {
      await _clientBox.delete('olm_account');
    } else {
      await _clientBox.put('olm_account', olmAccount);
    }
  });
  return;
}