ruutMessagesDaoProvider top-level property

ProviderFamily<RuutMessagesDao, RuutParameters> ruutMessagesDaoProvider
final

Provides an instance of ruut user dao

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

Implementation

final ruutMessagesDaoProvider =
    Provider.family<RuutMessagesDao, RuutParameters>((ref, params) {
  if (!params.isPersistenceEnabled) {
    return NonPersistedRuutMessagesDao();
  }
  final messagesBox = ref.read(messagesBoxProvider);
  final messageToClientInstanceBox =
      ref.read(messageToClientInstanceBoxProvider);
  return PersistedRuutMessagesDao(
      messagesBox, messageToClientInstanceBox, params.clientInstanceKey);
});