chatwootMessagesDaoProvider top-level property

ProviderFamily<ChatwootMessagesDao, ChatwootParameters> chatwootMessagesDaoProvider
final

Provides an instance of chatwoot user dao

Creates an in memory storage if persistence isn't enabled in params else hive boxes are create to store chatwoot client's messages

Implementation

final chatwootMessagesDaoProvider =
    Provider.family<ChatwootMessagesDao, ChatwootParameters>((ref, params) {
  if (!params.isPersistenceEnabled) {
    return NonPersistedChatwootMessagesDao();
  }
  final messagesBox = ref.read(messagesBoxProvider);
  final messageToClientInstanceBox =
      ref.read(messageToClientInstanceBoxProvider);
  return PersistedChatwootMessagesDao(
      messagesBox, messageToClientInstanceBox, params.clientInstanceKey);
});