chatwootContactDaoProvider top-level property

ProviderFamily<ChatwootContactDao, ChatwootParameters> chatwootContactDaoProvider
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 contact

Implementation

final chatwootContactDaoProvider =
    Provider.family<ChatwootContactDao, ChatwootParameters>((ref, params) {
  if (!params.isPersistenceEnabled) {
    return NonPersistedChatwootContactDao();
  }

  final contactBox = ref.read(contactBoxProvider);
  final clientInstanceToContactBox =
      ref.read(clientInstanceToContactBoxProvider);
  return PersistedChatwootContactDao(
      contactBox, clientInstanceToContactBox, params.clientInstanceKey);
});