Closed MagnoGeek closed 8 months ago
You should not store the whole Patientes.toMap but instead store each Patient as a record in your store
You should not store the whole Patientes.toMap but instead store each Patient as a record in your store
Thanks for your replay. I implemented in this way:
class PacienteRepositoryImpl extends PacienteRepository {
final Database _db = GetIt.I.get();
final StoreRef _store = intMapStoreFactory.store("paciente_store");
@override
Future<List> insertPacientes( Pacientes pacientes) async {
final list = [];
pacientes.items.forEach((patient) {
list.add( patient.toMap() );
});
return await _store.addAll( _db, list );
}
Is this the way correct?
so I make the call:
"Patientes" have two records.
final pacientesId = await _pacienteRepository.insertPacientes( pacientes ); final pacientesStore = await _pacienteRepository.getPacientes();
when I do a print: print('Id pacientes creado Local $pacientesId');
it prints: Id pacientes creado Local [1, 2]
when I do a print: print('Pacientes Almacenados Localmente:'); print(pacientesStore); print('');
It prints: It just shows one record even when there're two
[Record(paciente_store, 1)
{
paciente_id: 108,
tipo_identificacionId: 1,
tipo_identificacion: CC,
identificacion: 38957079,
primer_nombre: ROSA,
primer_apellido: LOPEZ,
cie: [
{
codigo: R263,
nombre: INMOVILIDAD,
fecha_diagnostico: 2019-10-19,
status: 1},
{
codigo: F000,
nombre: DEMENCIA EN LA ENFERMEDAD DE ALZHEIMER, DE COMIENZO TEMPRANO (G30.0†),
fecha_diagnostico: 2019-10-19,
status: 1}
]
}
How Can I access this records my friend? thank you again for your answer...
Hard to help you here with more information (I cannot tell whether getPacientes is implemented correctly if I don't see it) Could you try to reproduce your issue in a unit test?
@alextekartik Thanks for your replay. I'm using freezed to create the models, How can I implement it to retrieve data from a store?
Greetings, I am new to programming in dart, and with the use of sembast. With the following model I can create a list of patients in a store called patients_store:
Please, Be so nice and guide me, on how can I get that list created from sembast?