-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
fix(package_info_plus): data serialization converts installTime to String instead of DateTime #3464
Conversation
This commit addresses an issue where the `installTime` was not being properly serialized due to being a `DateTime` object. When attempting to convert the object to JSON, an error occurred as `DateTime` is not natively encodable. The `installTime` is now explicitly converted to a string before being included in the JSON, preventing the serialization failure.
Thanks for catching this up. It is probably better to use |
Seems that some tests need to be fixed as well. |
Updated the 'installTime' field to be converted to ISO 8601 string format instead of default string representation. This change ensures consistency in date formatting for better compatibility and parsing.
@miquelbeltran, I updated installTime format to ISO 8601 string for consistency (hope this helps with parsing and compatibility). |
Github actions is showings lots of errors, please ensure that the project has no analysis errors and all tests pass |
- Updated the 'installTime' field to use a fallback empty string if 'installTime' is null, ensuring no null values are passed. - This change improves stability by preventing potential null-related errors.
- Refactored the conditional check for 'installTime' to improve readability and maintain consistent code style. - The fallback to an empty string is maintained if 'installTime' is null.
@miquelbeltran, I'm almost there, but one of the GitHub Actions is failing. All tests work fine locally, and I believe the failing test isn't critical. Can we move ahead? Could you review my PR and merge it? |
Don't worry about failing Android integration tests - they are flaky and having time outs not because of your changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing the CI issues!
I changed the conditional access, since the variable is already checked if it was null. I've added a test to check JSON conversion of the Data payload to ensure this doesn't break in the future. |
@miquelbeltran & @vbuberen, thanks so much for considering, reviewing, and merging the PR! I really appreciate the time and effort put into it. Looking forward to more collaborations! |
This commit addresses an issue where the
installTime
was not being properly serialized due to being aDateTime
object. When attempting to convert the object to JSON, an error occurred asDateTime
is not natively encodable. TheinstallTime
is now explicitly converted to a string before being included in the JSON, preventing the serialization failure.Description
This PR addresses an issue where the
installTime
(aDateTime
object) was not being properly serialized into JSON, causing errors when trying to encode the object. TheinstallTime
is now explicitly converted to a string before it’s included in the JSON, ensuring compatibility with the encoding process. This change prevents the "Converting object to an encodable object failed" error and allows for correct JSON handling.Related Issues
Checklist
CHANGELOG.md
nor the plugin version inpubspec.yaml
files.flutter analyze
) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?
!
in the title as explained in Conventional Commits).