-
-
Notifications
You must be signed in to change notification settings - Fork 663
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
platform: Correctly handle integer-like numbers from JSON (#1531)
In JSON, an allowed representation for doubles without a fractional part like `1.0` is actually `1`. This is, for example, the behavior of [JSONEncoder][1]. When using `jsonDecode`, a `0` or `1` is deserialized to an `int`, which would then cause `Position.fromMap` to crash. Instead, use `toDouble()` to ensure that the value is converted to a `double`. [1]: https://developer.apple.com/documentation/foundation/jsonencoder
- Loading branch information
1 parent
026534d
commit 39c39ae
Showing
4 changed files
with
38 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters