sdk-for-flutter
sdk-for-flutter copied to clipboard
fixing Unhandled Exception: type 'Null' is not a subtype of type 'Lis…
What does this PR do?
This PR resolves Issue #173 by implementing a fix in the serialization process of the User class. The labels field, which previously could lead to a type cast error when null, has been adjusted to handle null values gracefully. This change ensures that when labels is null, it defaults to an empty list, thereby avoiding the "type 'Null' is not a subtype of type 'List
Test Plan
To verify these changes:
- Added unit tests to ensure that the
User.fromMapmethod correctly handles cases wherelabelsis null. - Conducted manual testing to ensure that serialization and deserialization of
Userobjects work as expected, even whenlabelsis null. - Reviewed all other usages of the
Userclass to ensure compatibility with this change.
Related PRs and Issues
This PR directly resolves Issue #173. No other related PRs at this time.
Additional Information
This change is a crucial step towards robust and error-resistant handling of optional fields in data models, enhancing the stability of the Appwrite codebase.
Have you read the Contributing Guidelines on issues?
Yes, I have read the contributing guidelines and ensured that my PR aligns with them.
I think this can be closed because the Bug from #173 is fixed in the SDK generator now: https://github.com/appwrite/sdk-generator/pull/751
Unfortunately, this is a read-only repo as the code is generated by our SDK Generator, and changes made only here would be wiped in the next release.