How do I declare 64bit unsigned int in dart/flutter?

前端 未结 1 619
再見小時候
再見小時候 2021-01-12 02:24

For an app, I need a 64bit unsigned int. Looking at dart documentation I did not see how to exactly go about declaring one.

Can anyone tell me how this is done? I wi

相关标签:
1条回答
  • 2021-01-12 02:57

    Dart does not have a native unsigned 64-bit integer.

    For many operations, you can just use the signed 64-bit integer that an int is, and interpret it as unsigned. It's the same bits. That won't work with division, though. (And if it's for the web, then an int is a JavaScript number, and you need to do something completely different).

    The simplest general approach is to use a BigInt and use toUnsigned(64) after you do any operations on it.

    0 讨论(0)
提交回复
热议问题