Steps to reproduce ('somefile.txt' has 'hello' string):
new File('somefile.txt').open().then((r) {
print(r.readSync(65535).length);
});
Output: 65536
Not sure if it's a bug, but it looks weird and inconsistent with the following similar test result:
new File('somefile.txt').open().then((r) {
r.read(65535).then((List<int> result) {
print(result.length);
});
});
Output: 5
If it helps, it all ends up in File_Read and FileReadRequest native implementation differences - the first one (used in readSync()) always returns the number of bytes requested, but the second one always returns list of the correct length.
This issue was originally filed by smok@google.com
Steps to reproduce ('somefile.txt' has 'hello' string): new File('somefile.txt').open().then((r) { print(r.readSync(65535).length); }); Output: 65536
Not sure if it's a bug, but it looks weird and inconsistent with the following similar test result: new File('somefile.txt').open().then((r) { r.read(65535).then((List<int> result) { print(result.length); }); }); Output: 5
If it helps, it all ends up in File_Read and FileReadRequest native implementation differences - the first one (used in readSync()) always returns the number of bytes requested, but the second one always returns list of the correct length.