-
Notifications
You must be signed in to change notification settings - Fork 135
Open
Labels
enhancementNew feature or requestNew feature or request
Description
In #229, the example supporting freezed entities uses assignable ids. Since freezed demands entities to be immutable, attempts to use value 0 ids fail in
if (prevId == 0) _entity.setId(object, result); |
Unhandled Exception: Invalid argument(s): Field Model.id is read-only (final or getter-only) and it was declared to be self-assigned. However, the currently inserted object (.id=0) doesn't match the inserted ID (ID 1). You must assign an ID before calling [box.put()].
Is it possible to use non-assignable ids with immutable entities currently? If not, would it be beneficial to make it so, e.g. by modifying the code above to use a copyWith or some other mechanism to set newly assigned ids?
humbertoadan, gmkado, ilikerobots, PuffPastry, lampian and 21 moreUnluckyY1
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request