toBytes static method
Converts a double value to bytes.
value
: The double value to encode.byteOrder
(optional): The byte order for encoding. Defaults to big endian.
Implementation
static List<int> toBytes(double value, {Endian byteOrder = Endian.big}) {
final ByteData byteData = ByteData(4);
byteData.setFloat32(0, value, byteOrder);
return byteData.buffer.asUint8List();
}