Skip to content
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

Saving existing model object updates createdAt field #39

Open
vladaman opened this issue Dec 5, 2021 · 0 comments
Open

Saving existing model object updates createdAt field #39

vladaman opened this issue Dec 5, 2021 · 0 comments

Comments

@vladaman
Copy link

vladaman commented Dec 5, 2021

Every time we save model it also updates createdAt and updatedAt field. We'd expect the createdAt field would not be updated for future object updates.

Code sample:

final batch = Batch()
..save(existingObject);
await batch.commit();

We can use Batch()..update() but the behavior is different. It will update just updatedAt field but on the device it will set createdAt field to null. Is this expected behavior?

final batch = Batch()
  ..update(existingObject);
  await batch.commit();
  debugPrint("New Val: ${existingObject.createdAt}"); // here createdAt is null

We believe the issue is here, where createdAt will be set to null:

_createdAt = createdAt;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant