-
Notifications
You must be signed in to change notification settings - Fork 265
Open
Labels
DocumentationImprovements or fixes to public documentation (docs.amplify.aws, pub.dev, readmes).Improvements or fixes to public documentation (docs.amplify.aws, pub.dev, readmes).GraphQL APIIssues related to the API (GraphQL) CategoryIssues related to the API (GraphQL) Categoryfeature-requestA request for a new feature or an enhancement to an existing API or category.A request for a new feature or an enhancement to an existing API or category.
Description
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
- Analytics
- API (REST)
- API (GraphQL)
- Auth
- Authenticator
- DataStore
- Notifications (Push)
- Storage
Steps to Reproduce
Take this model:
type Model @model {
id: ID!
nullableField: String
}
This is the auto-generated Model.dart, which we use to update the model.
Model copyWith({String? nullableField}) {
return Model._internal(
id: id,
nullableField: nullableField ?? this.nullableField,
)
}
If you run:
model = model.copyWith(nullableField: null)
Your model will not change the nullableField to null.
Screenshots
No response
Platforms
- iOS
- Android
- Web
- macOS
- Windows
- Linux
Flutter Version
3.22.0
Amplify Flutter Version
1.7.0
Deployment Method
Amplify CLI
Schema
type Model @model {
id: ID!
nullableField: String
}
Metadata
Metadata
Assignees
Labels
DocumentationImprovements or fixes to public documentation (docs.amplify.aws, pub.dev, readmes).Improvements or fixes to public documentation (docs.amplify.aws, pub.dev, readmes).GraphQL APIIssues related to the API (GraphQL) CategoryIssues related to the API (GraphQL) Categoryfeature-requestA request for a new feature or an enhancement to an existing API or category.A request for a new feature or an enhancement to an existing API or category.