I'm working on a flutter project with lots of bytes and byte arrays. I noticed that i had access to Uint8 and Uint8List. If i understand correctly, the Uint8List will save some memory over using a normal list with bytes. However, it seems that the Uint8List only accepts regular integers. Is there any usecase for using Uint8 type? Or should i be using the int type for bytes?
Edit: The question is answered here
According to the documentation here, it accepts integers and then truncates those to the lower eight bits. This means you can effectively store four list entries in a standard 32 bit integer. When retrieving an integer, the integer is most likely prepended by the amount of bytes a reqular int
uses.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With