fromBytes static method
Converts bytes to a float value.
bytes: The bytes to decode. Must be exactly 4 bytes.byteOrder(optional): The byte order for decoding. Defaults to big endian.
Implementation
static double fromBytes(List<int> bytes, {Endian byteOrder = Endian.big}) {
if (bytes.length != 4) {
throw CoreErrors.invalidOperationArguments(
"fromBytes",
name: "bytes",
reason: "Float requires exactly 4 bytes.",
);
}
final ByteData byteData = ByteData.sublistView(Uint8List.fromList(bytes));
return byteData.getFloat32(0, byteOrder);
}