aeb-dev / json_events

BSD 3-Clause "New" or "Revised" License
6 stars 3 forks source link

The fields containing numbers are not working correctly on the web #9

Closed Blazt closed 9 months ago

Blazt commented 9 months ago

Hello, I'm currently using json_events version 1.2.0, and I'm experiencing a bug.

I've noticed an issue with integers and decimals. It works fine in all environments except on the web, where it doesn't function properly.

In my case, I noticed the issue when I realized that one of my fields named "size" contained -4294967276 instead of 20. I had encountered an error before when using json_events on the web, related to the maximum size of an integer in JavaScript. So, I suspected that the issue I just experienced was specifically related to the web version.

To reproduce the issue, you can follow these steps:

Utilize json_events version 1.2.0. Create or use a field named "size" in your JSON data. Observe the value of "size" being -4294967276 instead of the expected value (e.g., 20) when running your code in a web environment.

Or simply test your example on an online editor (for example: zapp.run). You will see that all fields containing numbers are incorrect.

I hope to see a fix soon if possible. If there are any issues with understanding, please feel free to ask for more information about the bug I've reported.

aeb-dev commented 9 months ago

So if I am understanding right with the following json object

{
  "size": 20
}

the size field is deserialized as -4294967276?

Blazt commented 9 months ago

Yes, on the web I encountered this problem. Probably the issue of passing numbers from Dart to JavaScript. Example: https://zapp.run/edit/dart-zoh006lmoh10 Do you manage to access this project on zapp.run ? If yes, you will see the problem directly in the console on the results.

aeb-dev commented 9 months ago

Thanks for the example. I am currently busy with work. I will try to arrange some time tomorrow to check

aeb-dev commented 9 months ago

I have published a new version, can you test it?

Blazt commented 9 months ago

I just tested it, and it works, great! Thanks for your responsiveness and efficiency. Until next time, I hope.

Blazt commented 9 months ago

Oh no! I tested it wrong. I'm still facing the issue with the value 0 and negative numbers. I'm getting 4294967296 with 0.

aeb-dev commented 9 months ago

I found the issue but could not find a proper solution yet. I will try to finalize tomorrow

aeb-dev commented 9 months ago

Could you give it another try?

Blazt commented 9 months ago

I tested quickly, according to my tests, it works! Thanks again for your responsiveness. I think I can close the issue.