ruutUserDaoProvider top-level property

ProviderFamily<RuutUserDao, RuutParameters> ruutUserDaoProvider
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 user info

Implementation

final ruutUserDaoProvider =
    Provider.family<RuutUserDao, RuutParameters>((ref, params) {
  if (!params.isPersistenceEnabled) {
    return NonPersistedRuutUserDao();
  }
  final userBox = ref.read(userBoxProvider);
  final clientInstanceToUserBoxBox = ref.read(clientInstanceToUserBoxProvider);
  return PersistedRuutUserDao(
      userBox, clientInstanceToUserBoxBox, params.clientInstanceKey);
});