When should Uint8 in Dart/Flutter be used?

Viewed 953

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?

1 Answers

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.

Related