syncConversation method

Future<void> syncConversation(
  1. String conversationId
)

Sync specific conversation.

Implementation

Future<void> syncConversation(String conversationId) async {
  _ensureInitialized();

  final existingConversation =
      await _database.getConversation(conversationId);
  if (_shouldRefreshConversationMetadata(existingConversation)) {
    final remoteConversation =
        await _registry.adapter.getConversation(conversationId);
    if (remoteConversation != null) {
      await _database.insertConversation(remoteConversation);
    }
  }

  final result = await _syncEngine.syncConversation(conversationId);
  // Seed pagination cursor from initial conversation sync
  if (result != null && _conversationPrevBatch[conversationId] == null) {
    _conversationPrevBatch[conversationId] = result.nextSyncToken;
  }
}