I noticed that doubles like 8.0 are "int" when the document is fetched in flutter dart
TL;DR
The issue was that when fetching a document in Flutter Dart from Appwrite, double attribute values like `8.0` were being treated as integers. The solution is to cast the value as a number type and then use `toDouble()` to get the correct double value. This behavior is expected because JSON always represents integers as whole numbers and not with decimal points.
Infinil
6 Sep, 2023, 19:52
is this expected behaviour?
Drake
6 Sep, 2023, 22:06
yes, because JSON will always be 8 and not 8.0. you'll have to parse and handle it accordingly
Infinil
9 Sep, 2023, 05:55
makes sense 👍
Infinil
9 Sep, 2023, 05:56
casting it as num type and then using toDouble() worked :)
Drake
9 Sep, 2023, 15:23
[SOLVED] Appwrite double attribute value is an int