Skip to content

Instantly share code, notes, and snippets.

@GreenAppers
Created March 15, 2019 17:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GreenAppers/6a56e255274fc86cee2fa1c333cf236f to your computer and use it in GitHub Desktop.
Save GreenAppers/6a56e255274fc86cee2fa1c333cf236f to your computer and use it in GitHub Desktop.
Weird Flutter Float32List issue
void printbytes(Uint8List bytes) {
Float32List binary = bytes.buffer.asFloat32List();
debugPrint("Z00 Uint8List: " + bytes.toString());
debugPrint("Z00 Float32List: " + binary.toString());
}
# Output, after two calls:
#
# flutter: Z00 Uint8List: [0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0,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 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.<…>
#
# flutter: Z00 Uint8List: [0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 248, 255, 127, 63, 0, 0, 128, 63, 0, 0, 128, 63, 248, 255, 127, 63, 0, 0, 128, 63, 254, 255, 127, 63, 236, 255, 127, 63, 0, 0, 128, 63, 0, 0, 128, 63, 252, 255, 127, 63, 0, 0, 128, 63, 254,<…>
# lutter: Z00 Float32List: [3.976563852673545e-31, 618092097627580500000.0, 4.465126713500221e+30, 2.342109093665688e-38, 4.304788882405838e-42, 5.831554006032442e-39, 5.831554006032442e-39, 5.831554006032442e-39, 5.831554006032442e-39, 5.831554006032442e-39, 5.831554006032442e-39, 5.831554006032442e-39, 5.831554006032442e-39, 5.831554006032442e-39, 5.831554006032442e-39, 5.831554006032442e-39, 5.831554006032442e-39, 5.831554006032442e-39, 5.831554006032442e-39, 5.831554006032442e-39, 5.831554006032442e-39, 5.831554006032442e-39, 5.831554006032442e-39, 5.831554006032442e-39, 5.831554006032442e-39, 5.831554006032442e-39, 5.831554006032442e-39, 5.831554006032442e-39, 5.831554006032442e-39, 5.831554006032442e-39, 5.831554006032442e-39, 5.831554006032442e-39, 5.831554006032442e-39, 5.831554006032442e-39, 5.831554006032442e-39, 5.831554006032442e-39, 5.831554006032442e-39, 5.831554006032442e-39, 5.831554006032442e-39, 5.831554006032442e-39, 5.831554006032442e-39, 5.831554006032442e-39, 5.831554006032<…>
#
# Same Uint8List but totally different Float32List?
#
# What is the variable?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment