Open sampaio96 opened 4 months ago
HI @sampaio96 - You can use model.copyWithModelFieldValues()
for this. See example here: https://github.com/aws-amplify/amplify-flutter/issues/1480#issuecomment-1589763058.
I am going to mark this as a docs issue since it doesn't appear to be shown in the documentation.
Thank you! Perfect.
thanks for opening this issue, we are working to improve our documentation.
Description
The auto-generated model.dart code on Flutter does not allow setting nullable fields to null.
model = model.copyWith(nullableField: null)
Does not work.We need an alternative like
model = model.removeKey(Model.NULLABLEFIELD)
Categories
Steps to Reproduce
Take this model:
This is the auto-generated Model.dart, which we use to update the model.
If you run:
Your model will not change the nullableField to null.
Screenshots
No response
Platforms
Flutter Version
3.22.0
Amplify Flutter Version
1.7.0
Deployment Method
Amplify CLI
Schema