-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated Object Not Persisting After PutAndGetAsync/PutAsync/Put in ObjectBox #667
Comments
Thanks for reporting! Is it possible that there are multiple objects inside Note: I labeled this issue with "more info required" so it will auto-close in a few days if there are no follow-up comments. |
@greenrobot-team , |
Thanks! Then, there must be an issue somewhere else. Please provide enough additional information so I can reproduce this! |
@greenrobot-team Here is some info regarding models ``This is my main Object:
challan object Model
The ChallanObjectModel is part of the BillingStateObjectboxModel. When I try to update any value in the challan object, it doesn't update. The update function is already shown in the first comment. I think this information should be enough, but let me know if you need more details. |
Thanks for the details. I tried to verify this and:
the relation is properly updated. test('gh-667-put-and-get-async', () async {
final box = store.box<BillingStateObjectboxModel>();
final object = BillingStateObjectboxModel(id: 0);
object.challanList.add(ChallanObjectModel(remarks: 'first'));
box.put(object);
final ch = ChallanObjectModel(remarks: 'second');
object.challanList[0] = ch;
var objectPut = await box.putAndGetAsync(object);
print(objectPut.challanList[0].remarks);
final objectGet = await box.getAsync(object.id);
print(objectGet!.challanList[0].remarks);
}); So this must be an issue with your implementation. In this case I can only help with a working test case that reproduces this. Side note, this is not valid Dart syntax for me:
Can you double-check this is similar to what the class actually looks like? |
What's the problem with this? Can you suggest a solution, please? |
For me Dart says this is invalid syntax and can't compile. Anyhow, that's not the main issue:
|
Why is it that when we update a list object and store it in ObjectBox using
PutAndGetAsync
, the logged value shows the updated ObjectBox, but in the next line, when we call theget
method to retrieve the same object and print its value in the console, it still shows the old value?Build info
Expected behavior
when i put updated ToMany List in objectbox it is not updating in local storage insertion and deletion is working fine but modificatin is not working.
Actual behavior
it should be update in local storage.
Code
Code
Logs, stack traces
TODO Add relevant logs, a stack trace or crash report.
Logs
The text was updated successfully, but these errors were encountered: