-
Notifications
You must be signed in to change notification settings - Fork 190
fix: 🐛 Handle null values for integer properties in Dart models #1210
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
base: master
Are you sure you want to change the base?
Conversation
WalkthroughUpdates templates/dart/lib/src/models/model.dart.twig to explicitly handle integer properties in fromMap: when property.type equals "integer", values are cast to int (or int? for optional). Existing logic for other non-array types remains: numbers use toDouble() with nullability as needed, and strings use toString() with nullability. Array, enum handling, and overall fromMap structure are unchanged. Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🔇 Additional comments (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
@iamngoni this issue as well seems to be related to $sequence, can you please verify its an actual issue now? we have reports that the issue has been fixed already since it was a server side change |
Hi @ChiragAgg5k, You're right that this is related to $sequence. However, I believe this PR is still valuable as a defensive measure because:
|
What does this PR do?
fix: 🐛 Handle null values for integer properties in Dart models
Fixes #1150 - Type 'Null' is not a subtype of type 'int' by adding explicit type casting for integer properties to properly handle null values for optional & required fields.
Test Plan
[x] Ran both Dart & Flutter tests (both passed)
Related PRs and Issues
#1150
Have you read the Contributing Guidelines on issues?
Yes
Summary by CodeRabbit
New Features
Bug Fixes
Improvements