Reputation: 407
I want to use byte variable to store byte data, but can't find anything yet. I know about byte array equivalent is Unit8List.
Upvotes: 0
Views: 274
Reputation: 71653
Dart has only one integer type, int
.
Those values are either signed 64-bit integers on the native VM, or non-fractional doubles when compiled to JavaScript (and then bit-wise operators only work on 32 bits, like in JavaScript).
So, if you want to store an integer, even a byte sized one, use int
.
If you want to ensure that your results are constrained to 8 bits, you can use result = result.toUnsigned(8);
afterwards (or just result &= 0xff;
).
Upvotes: 1