ruutContactDaoProvider top-level property

ProviderFamily<RuutContactDao, RuutParameters> ruutContactDaoProvider
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 contact

Implementation

final ruutContactDaoProvider =
    Provider.family<RuutContactDao, RuutParameters>((ref, params) {
  if (!params.isPersistenceEnabled) {
    return NonPersistedRuutContactDao();
  }

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