Currently, I am trying to use convert a hexadecimal string to a double. For background, I sending a number such as 2.0 through bluetooth to receive a byte array such as [0,0,0,64]
. From there I tried to converting it to a hexadecimal using hex.encode()
, and I received 00000040
.
At this point, I have been trying to find a method or function in flutter/dart to swap the endianess of the hexadecimal and mainly convert the hexadecimal to a double. I have tried dart functions such as double.parse()
and double.tryParse()
, but it does not seem to have options to add radix parameters to help designate that the string is a hexadecimal like int.tryParse()
.
主要,我需要一种将十六进制转换为双精度的方法。任何有用的帮助,将不胜感激。