Moor autogenerated primary key, value in null safety. #1148
-
Recently I have migrated my entire project to null safety. This is One of my Transaction table in the project.
The problem is before null safety migration was able to pass null value to primary key.
i have tried to add nullable type in table definition as
GENERATED DATA CLASS OF THIS TABLE:
but it not worked. Please help me regarding this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
moor generates an extra class along your table data class which is called (MyTable)Companion. |
Beta Was this translation helpful? Give feedback.
moor generates an extra class along your table data class which is called (MyTable)Companion.
That is meant to be used for insertions or updates. The id would be optional when using the companion. So instead of creating a list of data classes try creating a list of companions