GetDutchie / brick

An intuitive way to work with persistent data in Dart
https://getdutchie.github.io/brick/#/
298 stars 27 forks source link

Read from REST but Don't Write Back to REST #398

Closed SubutaDan closed 1 month ago

SubutaDan commented 1 month ago

I have what may be an unusual requirement. I am using on offline-first-with-REST data source to populate a pick list. It is working well. Now I would like to be able to write items back to it, but only have them go to Sqlite and not to REST. Is this possible?

I have a work-around in place, but it involves flushing and reloading the Brick provider frequently, so I would like to do better if I can.

Thanks very much.

hortigado commented 1 month ago

Hi can you try for example Repository().sqliteProvider.upsert(AgeModel(weight: 12, created: DateTime.now())); I haven't tried it but it should work. Regards

SubutaDan commented 1 month ago

Thanks, @hortigado . That seems to be just what I was looking for. -Dan

tshedor commented 1 month ago

Thank you @hortigado