File.readAsBytes
(and the sync version as well) should return Uint8List
rather than List<int>
. This is a backwards-compatible change since Uint8List
implements List<int>
.
1 thought on “File.readAsBytes should return Uint8List”
Comments are closed.
Here’s the use case: I’m reviewing code that defines a new API for comparing binary images as bytes. The API currently takes
List<int>
for each image’s bytes, and in my review, I stated that they should takeUint8List
instead. However, if they do that, then callers will have to take the results ofFile.reasdAsBytes
and then callnew Uint8List.fromList(bytes)
because they can’t assume that they already have aUint8List
. They should be able to know that they’re receiving aUint8List
fromFile.reasAsBytes