How to handle integers too large for uint64_t in a synchronous Dart native extension?

193 Views Asked by At

When the user passes a number larger than 2^64 - 1 to a native function then the integer can't fit into a unit64_t.

What is the simplest way to write a synchronous native extension that can handle integers of arbitrarily large size? Since it appears we must use the Dart_Embedding API to retrieve values from a Dart_NativeArguments instance, how do we retrieve these values without loss of precision?

1

There are 1 best solutions below

0
On

Blasphemous suggestion: pass it as a string ? ;-)

Or [de]mangle it into/out of byte array ?